mirror of
https://github.com/daylinmorgan/oizys.git
synced 2025-02-23 03:45:50 -06:00
remove extra derivation type
This commit is contained in:
parent
5e81e4e52b
commit
593eba6ba4
1 changed files with 10 additions and 18 deletions
|
@ -135,7 +135,6 @@ proc toBuildNixosConfiguration(): seq[string] =
|
||||||
cmd.addArgs nixosConfigAttrs()
|
cmd.addArgs nixosConfigAttrs()
|
||||||
let (_, err) = runCmdCaptWithSpinner(
|
let (_, err) = runCmdCaptWithSpinner(
|
||||||
cmd,
|
cmd,
|
||||||
# BUG: hwylterm spinner not showing styled text?
|
|
||||||
"running dry run build for: " & (getHosts().join(" ").bb("bold")),
|
"running dry run build for: " & (getHosts().join(" ").bb("bold")),
|
||||||
capture = {CaptStderr}
|
capture = {CaptStderr}
|
||||||
)
|
)
|
||||||
|
@ -213,11 +212,6 @@ func isIgnored(drv: string): bool =
|
||||||
if name.startswith(pkg):
|
if name.startswith(pkg):
|
||||||
return true
|
return true
|
||||||
|
|
||||||
type
|
|
||||||
OizysDerivation = object
|
|
||||||
drv: NixDerivation
|
|
||||||
name: string
|
|
||||||
|
|
||||||
proc getSystemPathDrvs*(): seq[string] =
|
proc getSystemPathDrvs*(): seq[string] =
|
||||||
let systemDrvs = nixDerivationShow(nixosConfigAttrs())
|
let systemDrvs = nixDerivationShow(nixosConfigAttrs())
|
||||||
let systemPathDrvs = findSystemPaths(systemDrvs)
|
let systemPathDrvs = findSystemPaths(systemDrvs)
|
||||||
|
@ -228,22 +222,18 @@ proc getSystemPathDrvs*(): seq[string] =
|
||||||
inputDrv
|
inputDrv
|
||||||
|
|
||||||
|
|
||||||
proc getOizysDerivations(): HashSet[OizysDerivation] =
|
proc getOizysDerivations(): HashSet[NixDerivation] =
|
||||||
let
|
let
|
||||||
toBuildDrvs = toBuildNixosConfiguration()
|
toBuildDrvs = toBuildNixosConfiguration()
|
||||||
systemPathDrvs = getSystemPathDrvs()
|
systemPathDrvs = getSystemPathDrvs()
|
||||||
toActullyBuildDrvs = systemPathDrvs.filterIt(it in toBuildDrvs and not isIgnored(it))
|
toActullyBuildDrvs = systemPathDrvs.filterIt(it in toBuildDrvs and not isIgnored(it))
|
||||||
for name, drv in nixDerivationShow(toActullyBuildDrvs):
|
for _ , drv in nixDerivationShow(toActullyBuildDrvs):
|
||||||
result.incl OizysDerivation(
|
result.incl drv
|
||||||
name: name,
|
|
||||||
drv: drv,
|
|
||||||
)
|
|
||||||
|
|
||||||
proc showOizysDerivations*() =
|
proc showOizysDerivations*() =
|
||||||
let drvs = getOizysDerivations()
|
let drvs = getOizysDerivations()
|
||||||
echo drvs.mapIt(it.name & "^*").join("\n")
|
echo drvs.mapIt(it.name & "^*").join("\n")
|
||||||
|
|
||||||
|
|
||||||
# TODO: remove this proc
|
# TODO: remove this proc
|
||||||
proc systemPathDrvsToBuild*(): seq[string] =
|
proc systemPathDrvsToBuild*(): seq[string] =
|
||||||
var inputDrvs, dropped: seq[string]
|
var inputDrvs, dropped: seq[string]
|
||||||
|
@ -334,7 +324,7 @@ func formatDuration(d: Duration): string =
|
||||||
result.add " and "
|
result.add " and "
|
||||||
result.add $(seconds mod 60) & " seconds"
|
result.add $(seconds mod 60) & " seconds"
|
||||||
|
|
||||||
proc build(drv: OizysDerivation, rest: seq[string]): BuildResult =
|
proc build(drv: NixDerivation, rest: seq[string]): BuildResult =
|
||||||
let startTime = now()
|
let startTime = now()
|
||||||
var cmd = "nix build"
|
var cmd = "nix build"
|
||||||
cmd.addArg drv.name & "^*"
|
cmd.addArg drv.name & "^*"
|
||||||
|
@ -350,11 +340,11 @@ proc build(drv: OizysDerivation, rest: seq[string]): BuildResult =
|
||||||
warn "failed to build: " & splitDrv(drv.name).name
|
warn "failed to build: " & splitDrv(drv.name).name
|
||||||
info "-> duration: " & formatDuration(result.duration)
|
info "-> duration: " & formatDuration(result.duration)
|
||||||
|
|
||||||
func outputsPaths(o: OizysDerivation): seq[string] =
|
func outputsPaths(drv: NixDerivation): seq[string] =
|
||||||
for _, output in o.drv.outputs:
|
for _, output in drv.outputs:
|
||||||
result.add output.path
|
result.add output.path
|
||||||
|
|
||||||
proc reportResults(results: seq[(OizysDerivation, BuildResult)]) =
|
proc reportResults(results: seq[(NixDerivation, BuildResult)]) =
|
||||||
let rows = collect(
|
let rows = collect(
|
||||||
for (drv, res) in results:
|
for (drv, res) in results:
|
||||||
let (name, hash) = splitDrv(drv.name)
|
let (name, hash) = splitDrv(drv.name)
|
||||||
|
@ -379,15 +369,17 @@ proc prettyDerivation*(path: string): BbString =
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
if findExe(service) == "": fatalQuit fmt"is {service} installed?"
|
if findExe(service) == "": fatalQuit fmt"is {service} installed?"
|
||||||
info bbfmt"building and pushing to cache: [b]{name}"
|
info bbfmt"building and pushing to cache: [b]{name}"
|
||||||
debug "determining missing cache hits"
|
debug "determining missing cache hits"
|
||||||
|
|
||||||
let drvs = getOizysDerivations()
|
let drvs = getOizysDerivations()
|
||||||
if drvs.len == 0:
|
if drvs.len == 0:
|
||||||
info "nothing to build"
|
info "nothing to build"
|
||||||
quit "exiting...", QuitSuccess
|
quit "exiting...", QuitSuccess
|
||||||
|
|
||||||
info fmt("need to build {drvs.len} derivations:\n") & drvs.mapIt(prettyDerivation(" " & it.drv.outputs["out"].path)).join("\n")
|
info fmt("need to build {drvs.len} derivations:\n") & drvs.mapIt(prettyDerivation(" " & it.outputs["out"].path)).join("\n")
|
||||||
if dry:
|
if dry:
|
||||||
quit "exiting...", QuitSuccess
|
quit "exiting...", QuitSuccess
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue