change to bootstrap mode

This commit is contained in:
Daylin Morgan 2025-02-17 14:01:43 -06:00
parent d78a333192
commit 50207f639a
Signed by: daylin
GPG key ID: 950D13E9719334AD
3 changed files with 13 additions and 14 deletions

View file

@ -28,10 +28,9 @@ hwylCli:
`reset-cache`:
? "set cache timeout to 0"
ident resetCache
substitute:
? "use builtin substituter"
- s
bootstrap:
? "enable bootstrap mode"
- b
[misc]
yes:
- y
@ -41,7 +40,7 @@ hwylCli:
- m
preSub:
setupLoggers()
updateContext(host, flake, verbose, resetCache, substitute)
updateContext(host, flake, verbose, resetCache, bootstrap)
subcommands:
[build]

View file

@ -12,7 +12,7 @@ type
ci: bool
verbose: Count
resetCache: bool
substitute: bool
bootstrap: bool
let currentHost* = getHostName()
@ -36,7 +36,7 @@ proc getFlake*(): string = return oc.flake
proc isResetCache*(): bool = return oc.resetCache
proc isCi*(): bool = return oc.ci
proc isLocal*(): bool = return oc.flake.dirExists
proc isSubstitute*(): bool = return oc.substitute
proc isBootstrap*(): bool = return oc.bootstrap
@ -50,22 +50,21 @@ proc updateContext*(
flake: string,
verbose: Count,
resetCache: bool,
substitute: bool
bootstrap: bool,
) =
oc.verbose = verbose
oc.substitute = substitute
oc.bootstrap = bootstrap
if host.len > 0: oc.hosts = host
if verbose.val > 1:
consoleLogger.levelThreshold = lvlAll
oc.resetCache = resetCache
if flake != "":
oc.flake =
if flake.startsWith("github") or flake.startsWith("git+"): flake
if bootstrap: oc.flake
elif flake.startsWith("github") or flake.startsWith("git+"): flake
else: checkPath(flake.normalizedPath().absolutePath())
debug bb(fmt"""[b]flake[/]: {oc.flake}, [b]hosts[/]: {oc.hosts.join(" ")}""")
if not isLocal():
if not (isLocal() and isBootstrap()):
warn "not using local directory for flake"

View file

@ -22,6 +22,7 @@ type
`extra-substituters`: seq[string]
`extra-trusted-public-keys`: seq[string]
# TODO: replace with nim string defines?
func makeSubFlags(): seq[string] =
let subs = slurp("substituters.json").fromJson(Substituters)
for k, v in subs.fieldPairs():
@ -43,7 +44,7 @@ proc nixCommand*(cmd: string, nom: bool = false): string =
result.addArg "--narinfo-cache-negative-ttl 0"
if not (nom or isCi()):
result.addArg "--log-format multiline"
if isSubstitute():
if isBootstrap():
result.addArgs subFlags
proc nixosConfigAttr(host: string): string =