add flag to switch to using nom

This commit is contained in:
Daylin Morgan 2025-01-02 10:34:23 -07:00
parent cba22cbd48
commit f977e745d8
Signed by: daylin
GPG key ID: 950D13E9719334AD
2 changed files with 15 additions and 7 deletions

View file

@ -41,8 +41,10 @@ hwylCli:
... "nix build" ... "nix build"
flags: flags:
^minimal ^minimal
nom:
? "use nom"
run: run:
nixBuild(minimal, args) nixBuild(minimal, nom, args)
[cache] [cache]
... "build and push store paths" ... "build and push store paths"

View file

@ -7,12 +7,18 @@ import hwylterm, hwylterm/logging, jsony
import ./[context, exec] import ./[context, exec]
proc nixCommand(cmd: string): string = proc nixCommand(cmd: string, nom: bool = false): string =
result = "nix" if nom:
if findExe("nom") == "":
fatalQuit "--nom requires nix-output-monitor is installed"
result = "nom"
else:
result = "nix"
result.addArg cmd
if isResetCache(): if isResetCache():
result.addArg "--narinfo-cache-negative-ttl 0" result.addArg "--narinfo-cache-negative-ttl 0"
result.addArg "--log-format multiline" if not nom:
result.addArg cmd result.addArg "--log-format multiline"
proc nixosConfigAttr(host: string): string = proc nixosConfigAttr(host: string): string =
getFlake() & "#nixosConfigurations." & host & ".config.system.build.toplevel" getFlake() & "#nixosConfigurations." & host & ".config.system.build.toplevel"
@ -250,8 +256,8 @@ proc writeDervationsToStepSummary(drvs: seq[string]) =
output.writeLine(rows.join("\n")) output.writeLine(rows.join("\n"))
close output close output
proc nixBuild*(minimal: bool, rest: seq[string]) = proc nixBuild*(minimal: bool, nom: bool, rest: seq[string]) =
var cmd = nixCommand("build") var cmd = nixCommand("build", nom)
if minimal: if minimal:
debug "populating args with derivations not built/cached" debug "populating args with derivations not built/cached"
let drvs = systemPathDrvsToBuild() let drvs = systemPathDrvsToBuild()