withNixOutputMonitor: run shell with know Nix path

This commit is contained in:
tv 2022-09-07 11:55:35 +02:00
parent 6ee1d00b92
commit e5c13343a6
1 changed files with 3 additions and 2 deletions

View File

@ -9,7 +9,7 @@ in
}:
args: target:
runShell target {}
(withNixOutputMonitor useNixOutputMonitor /* sh */ ''
(withNixOutputMonitor target useNixOutputMonitor /* sh */ ''
nixos-rebuild -I ${
lib.concatMapStringsSep " " lib.escapeShellArg ([target.path] ++ args)
}
@ -37,7 +37,7 @@ in
])}
'';
withNixOutputMonitor = mode_: command: let
withNixOutputMonitor = target: mode_: command: let
mode =
lib.getAttr (lib.typeOf mode_) {
bool = lib.toJSON mode_;
@ -57,6 +57,7 @@ in
(${command}) 2>&1 | nom
'';
pessimistic = /* sh */ ''
NIX_PATH=${lib.escapeShellArg target.path} \
nix-shell -p nix-output-monitor --run ${lib.escapeShellArg optimistic}
'';
true = /* sh */ ''