From f977e745d8a60e3f51e3bf4d057deba6fa7a2cc6 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Thu, 2 Jan 2025 10:34:23 -0700 Subject: [PATCH] add flag to switch to using nom --- pkgs/oizys/src/oizys.nim | 4 +++- pkgs/oizys/src/oizys/nix.nim | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/pkgs/oizys/src/oizys.nim b/pkgs/oizys/src/oizys.nim index ab38178..7e92c17 100644 --- a/pkgs/oizys/src/oizys.nim +++ b/pkgs/oizys/src/oizys.nim @@ -41,8 +41,10 @@ hwylCli: ... "nix build" flags: ^minimal + nom: + ? "use nom" run: - nixBuild(minimal, args) + nixBuild(minimal, nom, args) [cache] ... "build and push store paths" diff --git a/pkgs/oizys/src/oizys/nix.nim b/pkgs/oizys/src/oizys/nix.nim index 9b73ef4..3bdaae3 100644 --- a/pkgs/oizys/src/oizys/nix.nim +++ b/pkgs/oizys/src/oizys/nix.nim @@ -7,12 +7,18 @@ import hwylterm, hwylterm/logging, jsony import ./[context, exec] -proc nixCommand(cmd: string): string = - result = "nix" +proc nixCommand(cmd: string, nom: bool = false): string = + if nom: + if findExe("nom") == "": + fatalQuit "--nom requires nix-output-monitor is installed" + result = "nom" + else: + result = "nix" + result.addArg cmd if isResetCache(): result.addArg "--narinfo-cache-negative-ttl 0" - result.addArg "--log-format multiline" - result.addArg cmd + if not nom: + result.addArg "--log-format multiline" proc nixosConfigAttr(host: string): string = getFlake() & "#nixosConfigurations." & host & ".config.system.build.toplevel" @@ -250,8 +256,8 @@ proc writeDervationsToStepSummary(drvs: seq[string]) = output.writeLine(rows.join("\n")) close output -proc nixBuild*(minimal: bool, rest: seq[string]) = - var cmd = nixCommand("build") +proc nixBuild*(minimal: bool, nom: bool, rest: seq[string]) = + var cmd = nixCommand("build", nom) if minimal: debug "populating args with derivations not built/cached" let drvs = systemPathDrvsToBuild()