mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-11-09 20:33:15 -06:00
Compare commits
No commits in common. "912be37cc031a7724adf298073045cf19e21f389" and "0b0132ee6d5387d499e2d17217310c7f146f4d6c" have entirely different histories.
912be37cc0
...
0b0132ee6d
5 changed files with 12 additions and 45 deletions
|
@ -8,6 +8,5 @@
|
||||||
cachix
|
cachix
|
||||||
graphviz
|
graphviz
|
||||||
typst
|
typst
|
||||||
charm-freeze
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,16 +33,16 @@ overlay:
|
||||||
echo nixosConfigAttrs().join(" ")
|
echo nixosConfigAttrs().join(" ")
|
||||||
|
|
||||||
proc update(yes: bool = false) =
|
proc update(yes: bool = false) =
|
||||||
## *TBI* update and run nixos-rebuild
|
## *TBD* update and run nixos-rebuild
|
||||||
fatal "not implemented"
|
fatal "not implemented"
|
||||||
|
|
||||||
proc build(minimal: bool = false) =
|
proc build(minimal: bool = false) =
|
||||||
## nix build
|
## nix build
|
||||||
nixBuild(minimal, rest)
|
nixBuild(minimal, rest)
|
||||||
|
|
||||||
proc cache(minimal: bool = false, name: string = "daylin") =
|
proc cache(name: string = "daylin") =
|
||||||
## build and push to cachix
|
## *TBD* build and push to cachix
|
||||||
nixBuildWithCache(minimal, name, rest)
|
fatal "not implemented"
|
||||||
|
|
||||||
proc osCmd() =
|
proc osCmd() =
|
||||||
## nixos-rebuild
|
## nixos-rebuild
|
||||||
|
@ -52,11 +52,12 @@ overlay:
|
||||||
error (
|
error (
|
||||||
&"unknown nixos-rebuild subcmd: {subcmd}\nexpected one of: \n" &
|
&"unknown nixos-rebuild subcmd: {subcmd}\nexpected one of: \n" &
|
||||||
nixosSubcmds.mapIt(" " & it).join("\n")
|
nixosSubcmds.mapIt(" " & it).join("\n")
|
||||||
); quit QuitFailure
|
)
|
||||||
|
quit QuitFailure
|
||||||
nixosRebuild(subcmd, rest[1..^1])
|
nixosRebuild(subcmd, rest[1..^1])
|
||||||
|
|
||||||
proc ci(`ref`: string = "main") =
|
proc ci(`ref`: string = "main") =
|
||||||
## trigger GHA update flow
|
## *TBD* trigger GHA update flow
|
||||||
if rest.len == 0:
|
if rest.len == 0:
|
||||||
fatal "expected workflow file name"; quit QuitFailure
|
fatal "expected workflow file name"; quit QuitFailure
|
||||||
createDispatch(rest[0], `ref`)
|
createDispatch(rest[0], `ref`)
|
||||||
|
@ -66,7 +67,7 @@ proc checkExes() =
|
||||||
quit("oizys requires nix", QuitFailure)
|
quit("oizys requires nix", QuitFailure)
|
||||||
|
|
||||||
proc `//`(t1: Table[string, string], t2: Table[string, string]): Table[string, string] =
|
proc `//`(t1: Table[string, string], t2: Table[string, string]): Table[string, string] =
|
||||||
# nix style shallow table merge
|
# nix style table merge
|
||||||
for k, v in t1.pairs(): result[k] = v
|
for k, v in t1.pairs(): result[k] = v
|
||||||
for k, v in t2.pairs(): result[k] = v
|
for k, v in t2.pairs(): result[k] = v
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import std/[
|
||||||
import ./spin
|
import ./spin
|
||||||
|
|
||||||
|
|
||||||
func addArgs*(cmd: var string, args: openArray[string]) =
|
func addArgs*(cmd: var string, args: seq[string]) =
|
||||||
cmd &= " " & args.join(" ")
|
cmd &= " " & args.join(" ")
|
||||||
|
|
||||||
func addArg*(cmd: var string, arg: string) =
|
func addArg*(cmd: var string, arg: string) =
|
||||||
|
|
|
@ -59,7 +59,7 @@ proc newFancyConsoleLogger*(
|
||||||
errorBb: string = "bold red",
|
errorBb: string = "bold red",
|
||||||
fatalBb: string = "bold red"
|
fatalBb: string = "bold red"
|
||||||
): FancyConsoleLogger =
|
): FancyConsoleLogger =
|
||||||
## Creates a new `FancyConsoleLogger<#ConsoleLogger>`_.
|
## Creates a new `ColoredConsoleLogger<#ConsoleLogger>`_.
|
||||||
new result
|
new result
|
||||||
let fmtStrs: array[Level, string] = [
|
let fmtStrs: array[Level, string] = [
|
||||||
genFmtStr(fmtPrefix,fmtSep, fmtSuffix, "", lvlAll),
|
genFmtStr(fmtPrefix,fmtSep, fmtSuffix, "", lvlAll),
|
||||||
|
|
|
@ -203,12 +203,10 @@ proc nixBuildHostDry*(minimal: bool, rest: seq[string]) =
|
||||||
quit "exiting...", QuitSuccess
|
quit "exiting...", QuitSuccess
|
||||||
cmd.addArgs drvs
|
cmd.addArgs drvs
|
||||||
cmd.addArg "--no-link"
|
cmd.addArg "--no-link"
|
||||||
|
|
||||||
if isCi():
|
if isCi():
|
||||||
writeDervationsToStepSummary drvs
|
writeDervationsToStepSummary drvs
|
||||||
else:
|
else:
|
||||||
cmd.addArgs nixosConfigAttrs()
|
cmd.addArgs nixosConfigAttrs()
|
||||||
|
|
||||||
cmd.addArg "--dry-run"
|
cmd.addArg "--dry-run"
|
||||||
cmd.addArgs rest
|
cmd.addArgs rest
|
||||||
let (_, err) =
|
let (_, err) =
|
||||||
|
@ -216,35 +214,4 @@ proc nixBuildHostDry*(minimal: bool, rest: seq[string]) =
|
||||||
let output = parseDryRunOutput err
|
let output = parseDryRunOutput err
|
||||||
display output
|
display output
|
||||||
|
|
||||||
# TODO: Add to bbansi
|
|
||||||
template `bbfmt`(pattern: static string): untyped =
|
|
||||||
bb(fmt(pattern))
|
|
||||||
|
|
||||||
proc nixBuildWithCache*(minimal: bool, name: string, rest:seq[string]) =
|
|
||||||
if findExe("cachix") == "":
|
|
||||||
fatal "is cachix installed?"; quit QuitFailure
|
|
||||||
info bbfmt"building and pushing to cache: [b]{name}"
|
|
||||||
var cmd = "cachix"
|
|
||||||
cmd.addArgs ["watch-exec","--"]
|
|
||||||
cmd.addArg "nix build"
|
|
||||||
if minimal:
|
|
||||||
debug "populating args with derivations not built/cached"
|
|
||||||
let drvs = systemPathDrvsToBuild()
|
|
||||||
if drvs.len == 0:
|
|
||||||
info "nothing to build"
|
|
||||||
quit "exiting...", QuitSuccess
|
|
||||||
cmd.addArgs drvs
|
|
||||||
cmd.addArg "--no-link"
|
|
||||||
else:
|
|
||||||
cmd.addArgs nixosConfigAttrs()
|
|
||||||
cmd.addArgs rest
|
|
||||||
debug cmd
|
|
||||||
quit QuitSuccess
|
|
||||||
let err = runCmd(cmd)
|
|
||||||
quit err
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue