feat(lib): Add nix-shell helper
All checks were successful
Run pre-commit on all files / pre-push (push) Successful in 19s

This allows running the specified script in a nix-shell invocation
This commit is contained in:
Tom Hubrecht 2025-01-14 18:21:59 +01:00
parent ce4011918c
commit 71fcc80fd9
Signed by: thubrecht
SSH key fingerprint: SHA256:CYNvFo44Ar9qCNnWNnvJVhs0QXO9AZjOLlPeWcSij3Q

View file

@ -10,7 +10,13 @@
let
inherit (pkgs) mkShell;
inherit (pkgs.lib) evalModules getExe recursiveUpdate;
inherit (pkgs.lib)
escapeShellArgs
evalModules
getExe
optionals
recursiveUpdate
;
inherit (pkgs.lib.fileset) gitTracked toSource;
@ -146,6 +152,24 @@ in
lib = rec {
expr = repr: "\${{ ${repr} }}";
secret = name: expr "secrets.${name}";
nix-shell =
{
script,
extraArgs ? [ ],
shell ? null,
}:
escapeShellArgs (
[ "nix-shell" ]
++ extraArgs
++ (optionals (shell != null) [
"-A"
shell
])
++ [
"--run"
script
]
);
};
steps =