From 32f3b3a309de58fee1594d857a6e5bd17afa0d34 Mon Sep 17 00:00:00 2001 From: DavHau Date: Thu, 4 Jul 2024 13:42:14 +0700 Subject: [PATCH] vars: add generator.runtimeInputs --- nixosModules/clanCore/vars/generator.nix | 2 +- nixosModules/clanCore/vars/interface.nix | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/nixosModules/clanCore/vars/generator.nix b/nixosModules/clanCore/vars/generator.nix index 3e1142bf..2693a8a3 100644 --- a/nixosModules/clanCore/vars/generator.nix +++ b/nixosModules/clanCore/vars/generator.nix @@ -8,7 +8,7 @@ finalScript = lib.mkOptionDefault '' set -eu -o pipefail - export PATH="${lib.makeBinPath config.path}:${pkgs.coreutils}/bin" + export PATH="${lib.makeBinPath config.runtimeInputs}:${pkgs.coreutils}/bin" ${lib.optionalString (pkgs.stdenv.hostPlatform.isLinux) '' # prepare sandbox user on platforms where this is supported diff --git a/nixosModules/clanCore/vars/interface.nix b/nixosModules/clanCore/vars/interface.nix index f9bce626..6e551faf 100644 --- a/nixosModules/clanCore/vars/interface.nix +++ b/nixosModules/clanCore/vars/interface.nix @@ -8,6 +8,7 @@ let either enum listOf + package path str submoduleWith @@ -31,7 +32,7 @@ in generators = { default = { imports = [ - # default implementation of the generator + # implementation of the generator ./generator.nix ]; }; @@ -109,6 +110,14 @@ in }; }); }; + runtimeInputs = { + description = '' + A list of packages that the generator script requires. + These packages will be available in the PATH when the script is run. + ''; + type = listOf package; + default = [ ]; + }; script = { description = '' The script to run to generate the files. @@ -129,6 +138,7 @@ in type = lib.types.str; readOnly = true; internal = true; + visible = false; }; }); };