1
0
Fork 0
mirror of https://cgit.krebsco.de/krops synced 2024-11-23 03:29:48 +01:00

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

View file

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