nix-eval-jobs only taks one argument

This commit is contained in:
Daylin Morgan 2025-02-17 18:56:09 -06:00
parent 9f178c0de0
commit 315a741882
Signed by: daylin
GPG key ID: 950D13E9719334AD

View file

@ -1,7 +1,7 @@
import std/[ import std/[
algorithm, json, enumerate, algorithm, json, enumerate,
os, sequtils, strformat, strutils, os, sequtils, strformat, strutils,
sugar, logging, tables, times sugar, logging, tables, times, sets
] ]
export tables export tables
import hwylterm, hwylterm/logging, jsony import hwylterm, hwylterm/logging, jsony
@ -226,14 +226,16 @@ proc getSystemPathInputDrvs*(): seq[string] =
proc missingDrvNixEvalJobs*(): seq[NixEvalOutput] = proc missingDrvNixEvalJobs*(): seq[NixEvalOutput] =
## get all derivations not cached using nix-eval-jobs ## get all derivations not cached using nix-eval-jobs
var cmd = ("nix-eval-jobs") var cmd = "nix-eval-jobs"
cmd.addArgs "--flake", "--check-cache-status" cmd.addArgs "--flake", "--check-cache-status"
cmd.addArgs getHosts().mapIt(".#systemPaths." & it) var output: string
let (output, _) = runCmdCaptWithSpinner( for host in getHosts():
cmd, let (o, _) = runCmdCaptWithSpinner(
bb"running [b]nix-eval-jobs[/] for system paths: " & (getHosts().join(" ").bb("bold")), cmd & (getFlake() & "#systemPaths." & host),
bb"running [b]nix-eval-jobs[/] for system path: " & host.bb("bold")
) )
output.add o
var cached: seq[NixEvalOutput] var cached: seq[NixEvalOutput]
var ignored: seq[NixEvalOutput] var ignored: seq[NixEvalOutput]
@ -250,6 +252,8 @@ proc missingDrvNixEvalJobs*(): seq[NixEvalOutput] =
debug "cached derivations: ", bb($cached.len, "yellow") debug "cached derivations: ", bb($cached.len, "yellow")
debug "ignored derivations: ", bb($ignored.len, "yellow") debug "ignored derivations: ", bb($ignored.len, "yellow")
result = result.toSet().toSeq()
func fmtDrvsForNix*(drvs: seq[NixEvalOutput]): string {.inline.} = func fmtDrvsForNix*(drvs: seq[NixEvalOutput]): string {.inline.} =
drvs.mapIt(it.drvPath & "^*").join(" ") drvs.mapIt(it.drvPath & "^*").join(" ")
@ -385,9 +389,9 @@ proc build(drv: NixEvalOutput, rest: seq[string]): BuildResult =
info "-> duration: " & formatDuration(result.duration) info "-> duration: " & formatDuration(result.duration)
func outputsPaths(drv: NixDerivation): seq[string] = # func outputsPaths(drv: NixDerivation): seq[string] =
for _, output in drv.outputs: # for _, output in drv.outputs:
result.add output.path # result.add output.path
proc reportResults(results: seq[(NixEvalOutput, BuildResult)]) = proc reportResults(results: seq[(NixEvalOutput, BuildResult)]) =
let rows = collect( let rows = collect(
@ -412,7 +416,6 @@ proc prettyDerivation*(path: string): BbString =
let drv = path.toDerivation() let drv = path.toDerivation()
drv.name.trunc(maxLen) & " " & drv.hash.bb("faint") drv.name.trunc(maxLen) & " " & drv.hash.bb("faint")
proc nixBuildWithCache*(name: string, rest: seq[string], service: string, jobs: int, dry: bool) = proc nixBuildWithCache*(name: string, rest: seq[string], service: string, jobs: int, dry: bool) =
## build individual derivations not cached and push to cache ## build individual derivations not cached and push to cache