more cache build changes

This commit is contained in:
Daylin Morgan 2024-11-03 13:59:34 -06:00
parent 84833821d0
commit 076a1c4ebd
Signed by: daylin
GPG key ID: 950D13E9719334AD

View file

@ -180,14 +180,18 @@ type
output: string output: string
name: string name: string
# func setStatus(od: var OizysDerivation, toBuild: seq[string], drvs: Table[string, NixDerivation]) = iterator getSystemPathDrvs(drvs: Table[string, NixDerivation]): string =
let systemPaths = findSystemPaths(drvs)
for p in systemPaths:
for d in drvs[p].inputDrvs.keys():
yield d
proc getOizysDerivations(): seq[OizysDerivation] = proc getOizysDerivations(): seq[OizysDerivation] =
let toBuild = toBuildNixosConfiguration() let toBuild = toBuildNixosConfiguration()
let drvs = evaluateDerivations(nixosConfigAttrs()) let drvs = evaluateDerivations(nixosConfigAttrs())
for name in toBuild: for name in getSystemPathDrvs(drvs):
if not isIgnored(name): if name in toBuild and not isIgnored(name):
let nixDrv = drvs[name] let nixDrv = drvs[name]
result.add OizysDerivation( result.add OizysDerivation(
name: name, name: name,
@ -203,6 +207,7 @@ proc systemPathDrvsToBuild(): seq[string] =
let systemPaths = findSystemPaths(drvs) let systemPaths = findSystemPaths(drvs)
for p in systemPaths: for p in systemPaths:
inputDrvs &= drvs[p].inputDrvs.keys().toSeq() inputDrvs &= drvs[p].inputDrvs.keys().toSeq()
(result, _) = filterSeq(inputDrvs, (s) => s in toBuild) (result, _) = filterSeq(inputDrvs, (s) => s in toBuild)
(dropped, result) = filterSeq(result, isIgnored) (dropped, result) = filterSeq(result, isIgnored)
echo "SOMETHING SHOULD HAPPEN HERE!" echo "SOMETHING SHOULD HAPPEN HERE!"
@ -283,7 +288,9 @@ proc nixBuildWithCache*(name: string, rest:seq[string], service: string, jobs: i
quit "exiting...", QuitSuccess quit "exiting...", QuitSuccess
# TODO: add back reporting to GITHUB SUMMARY # TODO: add back reporting to GITHUB SUMMARY
for drv in drvs:
echo drv.name
quit 1
# include time to build? # include time to build?
var outs: seq[string] var outs: seq[string]
for drv in drvs: for drv in drvs:
@ -291,14 +298,15 @@ proc nixBuildWithCache*(name: string, rest:seq[string], service: string, jobs: i
var cmd = "nix build" var cmd = "nix build"
cmd.addArg drv.name & "^*" cmd.addArg drv.name & "^*"
cmd.addArg "--no-link" cmd.addArg "--no-link"
cmd.addArg "--print-out-paths" # cmd.addArg "--print-out-paths"
cmd.addArg "-L" # cmd.addArg "-L"
cmd.addArgs rest cmd.addArgs rest
let buildCode = runCmd(cmd) let buildCode = runCmd(cmd)
if buildCode != 0: if buildCode != 0:
error "failed to build: " & drv.name error "failed to build: " & drv.name
continue continue
info "build duration: " & $(now() - startTime) info "build duration: " & $(now() - startTime)
info "---------------------------------------------------------------------------------------------------"
outs &= drv.output outs &= drv.output
var cmd = service var cmd = service