diff --git a/pkgs/oizys/src/oizys.nim b/pkgs/oizys/src/oizys.nim index 083182b..a6d3507 100644 --- a/pkgs/oizys/src/oizys.nim +++ b/pkgs/oizys/src/oizys.nim @@ -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] diff --git a/pkgs/oizys/src/oizys/context.nim b/pkgs/oizys/src/oizys/context.nim index 9683f11..4a6cf28 100644 --- a/pkgs/oizys/src/oizys/context.nim +++ b/pkgs/oizys/src/oizys/context.nim @@ -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" - - diff --git a/pkgs/oizys/src/oizys/nix.nim b/pkgs/oizys/src/oizys/nix.nim index 2a4fdb7..e0ab415 100644 --- a/pkgs/oizys/src/oizys/nix.nim +++ b/pkgs/oizys/src/oizys/nix.nim @@ -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 =