add debug back

This commit is contained in:
Daylin Morgan 2024-09-17 14:49:22 -05:00
parent abf883c176
commit 8f85abc1fc
Signed by: daylin
GPG key ID: 950D13E9719334AD

View file

@ -147,8 +147,18 @@ proc findSystemPaths(drvs: Table[string, NixDerivation]): seq[string] =
assert len(hosts) == len(result) assert len(hosts) == len(result)
proc filterSeq(
drvs: seq[string],
filter: proc(s: string): bool,
): tuple[yes: seq[string], no: seq[string]] =
for drv in drvs:
if filter(drv): result.yes.add drv
else: result.no.add drv
func isIgnored(drv: string): bool = func isIgnored(drv: string): bool =
const ignoredPackages = (slurp "ignored.txt").splitLines() const ignoredPackages = (slurp "ignored.txt").strip().splitLines()
let name = drv.split("-", 1)[1].replace(".drv","") let name = drv.split("-", 1)[1].replace(".drv","")
result = name in ignoredPackages result = name in ignoredPackages
if not result: if not result:
@ -157,17 +167,15 @@ func isIgnored(drv: string): bool =
return true return true
proc systemPathDrvsToBuild(): seq[string] = proc systemPathDrvsToBuild(): seq[string] =
var inputDrvs, dropped: seq[string]
let toBuild = toBuildNixosConfiguration() let toBuild = toBuildNixosConfiguration()
let drvs = evaluateDerivations(nixosConfigAttrs()) let drvs = evaluateDerivations(nixosConfigAttrs())
let systemPaths = findSystemPaths(drvs) let systemPaths = findSystemPaths(drvs)
var inputDrvs: seq[string]
for p in systemPaths: for p in systemPaths:
inputDrvs &= drvs[p].inputDrvs.keys().toSeq() inputDrvs &= drvs[p].inputDrvs.keys().toSeq()
result = inputDrvs.filterIt(it in toBuild) (result, _) = filterSeq(inputDrvs, (s) => s in toBuild)
let nToBuild = result.len (dropped, result) = filterSeq(result, isIgnored)
result = result.filterIt(not it.isIgnored) debug fmt"ignored {dropped.len} derivations"
let nIgnored = nToBuild - result.len
debug fmt"ignored {nIgnored} derivations"
result = result.mapIt(it & "^*") result = result.mapIt(it & "^*")
func splitDrv(drv: string): tuple[name, hash:string] = func splitDrv(drv: string): tuple[name, hash:string] =