Compare commits

..

No commits in common. "912be37cc031a7724adf298073045cf19e21f389" and "0b0132ee6d5387d499e2d17217310c7f146f4d6c" have entirely different histories.

5 changed files with 12 additions and 45 deletions

View file

@ -8,6 +8,5 @@
cachix
graphviz
typst
charm-freeze
]);
}

View file

@ -33,16 +33,16 @@ overlay:
echo nixosConfigAttrs().join(" ")
proc update(yes: bool = false) =
## *TBI* update and run nixos-rebuild
## *TBD* update and run nixos-rebuild
fatal "not implemented"
proc build(minimal: bool = false) =
## nix build
nixBuild(minimal, rest)
proc cache(minimal: bool = false, name: string = "daylin") =
## build and push to cachix
nixBuildWithCache(minimal, name, rest)
proc cache(name: string = "daylin") =
## *TBD* build and push to cachix
fatal "not implemented"
proc osCmd() =
## nixos-rebuild
@ -52,11 +52,12 @@ overlay:
error (
&"unknown nixos-rebuild subcmd: {subcmd}\nexpected one of: \n" &
nixosSubcmds.mapIt(" " & it).join("\n")
); quit QuitFailure
)
quit QuitFailure
nixosRebuild(subcmd, rest[1..^1])
proc ci(`ref`: string = "main") =
## trigger GHA update flow
## *TBD* trigger GHA update flow
if rest.len == 0:
fatal "expected workflow file name"; quit QuitFailure
createDispatch(rest[0], `ref`)
@ -66,7 +67,7 @@ proc checkExes() =
quit("oizys requires nix", QuitFailure)
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 t2.pairs(): result[k] = v

View file

@ -6,7 +6,7 @@ import std/[
import ./spin
func addArgs*(cmd: var string, args: openArray[string]) =
func addArgs*(cmd: var string, args: seq[string]) =
cmd &= " " & args.join(" ")
func addArg*(cmd: var string, arg: string) =

View file

@ -38,7 +38,7 @@ const defaultFlushThreshold = lvlAll
proc genFmtStr(
fmtPrefix, fmtSep, fmtSuffix, levelBb: string,
level: Level
): string =
): string =
var parts: seq[string]
if fmtPrefix != "": parts.add fmtPrefix
parts.add $LevelNames[level].bb(levelBb)
@ -58,8 +58,8 @@ proc newFancyConsoleLogger*(
warnBb: string = "bold yellow",
errorBb: string = "bold red",
fatalBb: string = "bold red"
): FancyConsoleLogger =
## Creates a new `FancyConsoleLogger<#ConsoleLogger>`_.
): FancyConsoleLogger =
## Creates a new `ColoredConsoleLogger<#ConsoleLogger>`_.
new result
let fmtStrs: array[Level, string] = [
genFmtStr(fmtPrefix,fmtSep, fmtSuffix, "", lvlAll),

View file

@ -203,12 +203,10 @@ proc nixBuildHostDry*(minimal: bool, rest: seq[string]) =
quit "exiting...", QuitSuccess
cmd.addArgs drvs
cmd.addArg "--no-link"
if isCi():
writeDervationsToStepSummary drvs
else:
cmd.addArgs nixosConfigAttrs()
cmd.addArg "--dry-run"
cmd.addArgs rest
let (_, err) =
@ -216,35 +214,4 @@ proc nixBuildHostDry*(minimal: bool, rest: seq[string]) =
let output = parseDryRunOutput err
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