feat(lib): Add nix-shell helper
All checks were successful
Run pre-commit on all files / pre-push (push) Successful in 19s
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:
parent
ce4011918c
commit
71fcc80fd9
1 changed files with 25 additions and 1 deletions
26
default.nix
26
default.nix
|
@ -10,7 +10,13 @@
|
||||||
let
|
let
|
||||||
inherit (pkgs) mkShell;
|
inherit (pkgs) mkShell;
|
||||||
|
|
||||||
inherit (pkgs.lib) evalModules getExe recursiveUpdate;
|
inherit (pkgs.lib)
|
||||||
|
escapeShellArgs
|
||||||
|
evalModules
|
||||||
|
getExe
|
||||||
|
optionals
|
||||||
|
recursiveUpdate
|
||||||
|
;
|
||||||
|
|
||||||
inherit (pkgs.lib.fileset) gitTracked toSource;
|
inherit (pkgs.lib.fileset) gitTracked toSource;
|
||||||
|
|
||||||
|
@ -146,6 +152,24 @@ in
|
||||||
lib = rec {
|
lib = rec {
|
||||||
expr = repr: "\${{ ${repr} }}";
|
expr = repr: "\${{ ${repr} }}";
|
||||||
secret = name: expr "secrets.${name}";
|
secret = name: expr "secrets.${name}";
|
||||||
|
nix-shell =
|
||||||
|
{
|
||||||
|
script,
|
||||||
|
extraArgs ? [ ],
|
||||||
|
shell ? null,
|
||||||
|
}:
|
||||||
|
escapeShellArgs (
|
||||||
|
[ "nix-shell" ]
|
||||||
|
++ extraArgs
|
||||||
|
++ (optionals (shell != null) [
|
||||||
|
"-A"
|
||||||
|
shell
|
||||||
|
])
|
||||||
|
++ [
|
||||||
|
"--run"
|
||||||
|
script
|
||||||
|
]
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
steps =
|
steps =
|
||||||
|
|
Loading…
Add table
Reference in a new issue