From 7017664679c8eb62e352faff57a783b61f914abb Mon Sep 17 00:00:00 2001 From: horyzon Date: Sat, 18 Jul 2026 18:04:43 +0000 Subject: [PATCH 1/4] fix: enables bootstrap input defaults --- modules/bootstrap/default.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/bootstrap/default.nix b/modules/bootstrap/default.nix index 4d8698e..2a8197e 100644 --- a/modules/bootstrap/default.nix +++ b/modules/bootstrap/default.nix @@ -1,6 +1,7 @@ { pkgs ? import { }, modules ? [ ], + bootstrap ? [ ], outdir ? ".", inputs ? null, outputs ? null, @@ -20,6 +21,19 @@ let tree = (import import-tree) modules; + bootstrapModule = + if bootstrap == true then + ./inputs.nix + else if builtins.isList bootstrap then + let + allInputs = (import ./inputs.nix { inherit lib; }).flake-file.inputs; + in + { flake-file.inputs = lib.filterAttrs (name: _: builtins.elem name bootstrap) allInputs; } + else if bootstrap == false then + { } + else + throw "flake-file bootstrap must be true, false, or a list of input names"; + attrsOpt = lib.mkOption { default = { }; type = lib.types.submodule { freeformType = lib.types.lazyAttrsOf lib.types.unspecified; }; @@ -27,6 +41,7 @@ let module = { imports = [ + bootstrapModule tree ./../default.nix ./../options From f24cc925bda403a7c691ecf0fa5d648e2526ee13 Mon Sep 17 00:00:00 2001 From: horyzon Date: Sat, 18 Jul 2026 18:08:22 +0000 Subject: [PATCH 2/4] test: covers bootstrap input defaults --- dev/_bootstrap-tests.nix | 72 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/dev/_bootstrap-tests.nix b/dev/_bootstrap-tests.nix index d535220..f33642d 100644 --- a/dev/_bootstrap-tests.nix +++ b/dev/_bootstrap-tests.nix @@ -48,6 +48,36 @@ let inputs.flake-parts.url = "github:hercules-ci/flake-parts"; }; + bootstrap-all = import ./.. ( + args + // { + bootstrap = true; + modules = { outputs = _: { }; }; + } + ); + + bootstrap-selected = import ./.. ( + args + // { + bootstrap = [ + "flake-file" + "nixpkgs" + ]; + modules = { outputs = _: { }; }; + } + ); + + bootstrap-override = import ./.. ( + args + // { + bootstrap = true; + modules = { + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + outputs = _: { }; + }; + } + ); + flake-parts-follows = bootstrap { inputs.nixpkgs-lib.url = "github:vic/empty-flake"; inputs.flake-parts.url = "github:hercules-ci/flake-parts"; @@ -84,6 +114,45 @@ let ''; }; + test-bootstrap-all-inputs = pkgs.writeShellApplication { + name = "test-bootstrap-all-inputs"; + runtimeInputs = [ + (bootstrap-all.flake-file.apps.write-inputs pkgs) + ]; + text = '' + write-inputs + grep github:vic/import-tree ${outdir}/inputs.nix + grep github:vic/flake-file ${outdir}/inputs.nix + grep github:hercules-ci/flake-parts ${outdir}/inputs.nix + grep nixpkgs-unstable ${outdir}/inputs.nix + ''; + }; + + test-bootstrap-selected-inputs = pkgs.writeShellApplication { + name = "test-bootstrap-selected-inputs"; + runtimeInputs = [ + (bootstrap-selected.flake-file.apps.write-inputs pkgs) + ]; + text = '' + write-inputs + grep github:vic/flake-file ${outdir}/inputs.nix + grep nixpkgs-unstable ${outdir}/inputs.nix + ! grep github:vic/import-tree ${outdir}/inputs.nix + ! grep github:hercules-ci/flake-parts ${outdir}/inputs.nix + ''; + }; + + test-bootstrap-input-override = pkgs.writeShellApplication { + name = "test-bootstrap-input-override"; + runtimeInputs = [ + (bootstrap-override.flake-file.apps.write-inputs pkgs) + ]; + text = '' + write-inputs + grep github:nixos/nixpkgs/nixos-unstable ${outdir}/inputs.nix + ''; + }; + test-npins = pkgs.writeShellApplication { name = "test-npins"; runtimeInputs = [ @@ -245,6 +314,9 @@ pkgs.mkShell { buildInputs = [ test-inputs test-flake + test-bootstrap-all-inputs + test-bootstrap-selected-inputs + test-bootstrap-input-override test-unflake test-npins test-npins-schemes From 091f3eb1c1d8eb951020250233bd8068c11bff60 Mon Sep 17 00:00:00 2001 From: horyzon Date: Sat, 18 Jul 2026 18:09:38 +0000 Subject: [PATCH 3/4] docs: describes bootstrap input defaults --- docs/src/content/docs/reference/bootstrap.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/content/docs/reference/bootstrap.mdx b/docs/src/content/docs/reference/bootstrap.mdx index d025aa3..5ec243f 100644 --- a/docs/src/content/docs/reference/bootstrap.mdx +++ b/docs/src/content/docs/reference/bootstrap.mdx @@ -46,7 +46,7 @@ The Nix file or directory containing your flake-file module definitions. All `.n ### `bootstrap` -Include predefined inputs from the built-in `bootstrap.nix`. When set to `true`, all bootstrap inputs are included. When set to a list, only the named inputs are included. +Include predefined inputs from `modules/bootstrap/inputs.nix`. When set to `true`, all bootstrap inputs are included. When set to a list, only the named inputs are included. These defaults are imported before your modules, so your modules can override them. - **Type:** `true` | list of input names - **Default:** `[]` (none) From af581bc8fb7f9d825962524971787e26b8aa6183 Mon Sep 17 00:00:00 2001 From: horyzon Date: Sat, 18 Jul 2026 18:18:19 +0000 Subject: [PATCH 4/4] test: avoids negated grep shellcheck warning --- dev/_bootstrap-tests.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dev/_bootstrap-tests.nix b/dev/_bootstrap-tests.nix index f33642d..3e44067 100644 --- a/dev/_bootstrap-tests.nix +++ b/dev/_bootstrap-tests.nix @@ -137,8 +137,12 @@ let write-inputs grep github:vic/flake-file ${outdir}/inputs.nix grep nixpkgs-unstable ${outdir}/inputs.nix - ! grep github:vic/import-tree ${outdir}/inputs.nix - ! grep github:hercules-ci/flake-parts ${outdir}/inputs.nix + if grep github:vic/import-tree ${outdir}/inputs.nix; then + exit 1 + fi + if grep github:hercules-ci/flake-parts ${outdir}/inputs.nix; then + exit 1 + fi ''; };