capture stderr with nixos-rebuild

This commit is contained in:
Daylin Morgan 2024-09-09 09:30:53 -05:00
parent ee0b137279
commit 8347ad4a55
Signed by: daylin
GPG key ID: 950D13E9719334AD
2 changed files with 3 additions and 2 deletions

View file

@ -19,3 +19,4 @@ restic-gdrive
gitea
lock
code
comma-with-db

View file

@ -23,10 +23,10 @@ const nixosSubcmds* =
repl build-vm build-vm-with-bootloader list-generations""".splitWhitespace()
proc nixosRebuild*(subcmd: string, rest: seq[string] = @[]) =
var cmd = fmt"sudo nixos-rebuild {subcmd} --flake {getFlake()} --log-format multiline"
if getHosts().len > 1:
error "nixos-rebuild only supports one host"
quit QuitFailure
var cmd = fmt"sudo nixos-rebuild {subcmd} --flake {getFlake()} --log-format multiline"
cmd.addArgs rest
quitWithCmd cmd
@ -217,7 +217,7 @@ proc nixBuildHostDry*(minimal: bool, rest: seq[string]) =
cmd.addArg "--dry-run"
cmd.addArgs rest
let (_, err) =
runCmdCaptWithSpinner(cmd, "evaluating derivation for: " & getHosts().join(" "))
runCmdCaptWithSpinner(cmd, "evaluating derivation for: " & getHosts().join(" "), {CaptStderr})
let output = parseDryRunOutput err
display output