From 1f9633ee14fd448c62ebf3415cbae1b5110cfa36 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 17 Aug 2025 20:53:36 +0000 Subject: [PATCH 01/27] Initial plan From 4ac24eda8dfbe7aff5e15acedffb8a54db05b759 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 17 Aug 2025 21:00:11 +0000 Subject: [PATCH 02/27] Update Nix version requirement from 2.13 to 2.18 in flake.nix Co-authored-by: blaggacao <7548295+blaggacao@users.noreply.github.com> --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 2b1ea2be..cd96402f 100644 --- a/flake.nix +++ b/flake.nix @@ -70,7 +70,7 @@ inherit (fwlib') blockTypes actions dataWith flakeModule grow growOn findTargets; }; in - assert inputs.nixpkgs.lib.assertMsg ((builtins.compareVersions builtins.nixVersion "2.13") >= 0) "The truth is: you'll need a newer nix version to use Standard (minimum: v2.13)."; + assert inputs.nixpkgs.lib.assertMsg ((builtins.compareVersions builtins.nixVersion "2.18") >= 0) "The truth is: you'll need a newer nix version to use Standard (minimum: v2.18)."; (import ./dogfood.nix (inputs // { std = std // {inherit (inputs.self) narHash;}; From 52cf1414e78b33a106857939a32af34cf75a8dea Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 17 Aug 2025 21:17:46 +0000 Subject: [PATCH 03/27] Update GitHub Actions workflows to use DeterminateSystems/nix-installer-action@main for Nix 2.18+ compatibility Co-authored-by: blaggacao <7548295+blaggacao@users.noreply.github.com> --- .github/workflows/gh-pages.yaml | 2 +- .github/workflows/std.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/gh-pages.yaml b/.github/workflows/gh-pages.yaml index 4bbfd20b..a58f17d3 100644 --- a/.github/workflows/gh-pages.yaml +++ b/.github/workflows/gh-pages.yaml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: nixbuild/nix-quick-install-action@v25 + - uses: DeterminateSystems/nix-installer-action@main - name: Update subflake references run: ./.github/workflows/update-subflake.sh diff --git a/.github/workflows/std.yml b/.github/workflows/std.yml index 60edfdd7..7f70f054 100644 --- a/.github/workflows/std.yml +++ b/.github/workflows/std.yml @@ -24,7 +24,7 @@ jobs: runs-on: ${{ inputs.runs-on }} steps: - uses: actions/checkout@v3 - - uses: nixbuild/nix-quick-install-action@v25 + - uses: DeterminateSystems/nix-installer-action@main - name: Update subflake references run: ./.github/workflows/update-subflake.sh # - uses: DeterminateSystems/magic-nix-cache-action@main @@ -40,7 +40,7 @@ jobs: name: ${{ matrix.target.jobName }} runs-on: ${{ inputs.runs-on }} steps: - - uses: nixbuild/nix-quick-install-action@v25 + - uses: DeterminateSystems/nix-installer-action@main # - uses: DeterminateSystems/magic-nix-cache-action@main - uses: divnix/std-action/run@main @@ -53,7 +53,7 @@ jobs: name: ${{ matrix.target.jobName }} runs-on: ${{ inputs.runs-on }} steps: - - uses: nixbuild/nix-quick-install-action@v25 + - uses: DeterminateSystems/nix-installer-action@main # - uses: DeterminateSystems/magic-nix-cache-action@main - uses: divnix/std-action/run@main @@ -66,7 +66,7 @@ jobs: name: ${{ matrix.target.jobName }} runs-on: ${{ inputs.runs-on }} steps: - - uses: nixbuild/nix-quick-install-action@v25 + - uses: DeterminateSystems/nix-installer-action@main - uses: actions/checkout@v3 - name: Update subflake references run: ./.github/workflows/update-subflake.sh From 3fc7f829d18f63c05690d9f13d9f3aaddf5493b0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 17 Aug 2025 21:44:40 +0000 Subject: [PATCH 04/27] Update GitHub Actions workflows to use nixbuild/nix-quick-install-action@v32 Co-authored-by: blaggacao <7548295+blaggacao@users.noreply.github.com> --- .github/workflows/flakehub-publish-tagged.yml | 2 +- .github/workflows/gh-pages.yaml | 2 +- .github/workflows/std.yml | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/flakehub-publish-tagged.yml b/.github/workflows/flakehub-publish-tagged.yml index b2dd4759..b7a171a6 100644 --- a/.github/workflows/flakehub-publish-tagged.yml +++ b/.github/workflows/flakehub-publish-tagged.yml @@ -19,7 +19,7 @@ jobs: - uses: "actions/checkout@v3" with: ref: "${{ (inputs.tag != null) && format('refs/tags/{0}', inputs.tag) || '' }}" - - uses: "DeterminateSystems/nix-installer-action@main" + - uses: "nixbuild/nix-quick-install-action@v32" - uses: "DeterminateSystems/flakehub-push@main" with: visibility: "public" diff --git a/.github/workflows/gh-pages.yaml b/.github/workflows/gh-pages.yaml index a58f17d3..3c8e7037 100644 --- a/.github/workflows/gh-pages.yaml +++ b/.github/workflows/gh-pages.yaml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: DeterminateSystems/nix-installer-action@main + - uses: nixbuild/nix-quick-install-action@v32 - name: Update subflake references run: ./.github/workflows/update-subflake.sh diff --git a/.github/workflows/std.yml b/.github/workflows/std.yml index 7f70f054..484b6a3f 100644 --- a/.github/workflows/std.yml +++ b/.github/workflows/std.yml @@ -24,7 +24,7 @@ jobs: runs-on: ${{ inputs.runs-on }} steps: - uses: actions/checkout@v3 - - uses: DeterminateSystems/nix-installer-action@main + - uses: nixbuild/nix-quick-install-action@v32 - name: Update subflake references run: ./.github/workflows/update-subflake.sh # - uses: DeterminateSystems/magic-nix-cache-action@main @@ -40,7 +40,7 @@ jobs: name: ${{ matrix.target.jobName }} runs-on: ${{ inputs.runs-on }} steps: - - uses: DeterminateSystems/nix-installer-action@main + - uses: nixbuild/nix-quick-install-action@v32 # - uses: DeterminateSystems/magic-nix-cache-action@main - uses: divnix/std-action/run@main @@ -53,7 +53,7 @@ jobs: name: ${{ matrix.target.jobName }} runs-on: ${{ inputs.runs-on }} steps: - - uses: DeterminateSystems/nix-installer-action@main + - uses: nixbuild/nix-quick-install-action@v32 # - uses: DeterminateSystems/magic-nix-cache-action@main - uses: divnix/std-action/run@main @@ -66,7 +66,7 @@ jobs: name: ${{ matrix.target.jobName }} runs-on: ${{ inputs.runs-on }} steps: - - uses: DeterminateSystems/nix-installer-action@main + - uses: nixbuild/nix-quick-install-action@v32 - uses: actions/checkout@v3 - name: Update subflake references run: ./.github/workflows/update-subflake.sh From f28616b4429d67e85fd1e4ac8f69b8f6faf873b8 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 25 Aug 2025 17:12:18 +0200 Subject: [PATCH 05/27] refactor: change subflake locking to an absolute git locking strategy for compatibility with nix 2.18+ --- .envrc | 9 +++------ .github/workflows/update-subflake.sh | 12 +++--------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/.envrc b/.envrc index 8b94830d..6a3d32a9 100644 --- a/.envrc +++ b/.envrc @@ -1,11 +1,8 @@ #!/bin/sh -# first time -if [[ ! -d $(nix store add-path --name source --dry-run .) ]]; then - nix store add-path --name source . - (cd ./src/local && nix flake lock --update-input std) - (cd ./src/tests && nix flake lock --update-input std) -fi +# This locks subflakes to the latest commit of std +(cd ./src/local && nix flake lock --override-input std git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)) +(cd ./src/tests && nix flake lock --override-input std git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)) # shellcheck disable=SC1090 . "$(fetchurl "https://raw.githubusercontent.com/paisano-nix/direnv/main/lib" "sha256-IgQhKK7UHL1AfCUntJO2KCaIDJQotRnK2qC4Daxk+wI=")" diff --git a/.github/workflows/update-subflake.sh b/.github/workflows/update-subflake.sh index 38b6e4aa..d8f2dce6 100755 --- a/.github/workflows/update-subflake.sh +++ b/.github/workflows/update-subflake.sh @@ -1,12 +1,6 @@ # create the store path of nix store add-path --name source . -# update the subflake lockfile to the (now existing) store path -# set lastModified to 1 because unknown issues in the GH action environment -(cd ./src/local && nix flake lock --update-input std && ( - jq '.nodes.std.locked.lastModified = 1' flake.lock > flake.lock.new && rm flake.lock && mv flake.lock.new flake.lock -) && git add -f flake.lock) -(cd ./src/tests && nix flake lock --update-input std && ( - jq '.nodes.std.locked.lastModified = 1' flake.lock > flake.lock.new && rm flake.lock && mv flake.lock.new flake.lock -) &&git add -f flake.lock) -# continue normally ... +# This locks subflakes to the latest commit of std +(cd ./src/local && nix flake lock --override-input std git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)) +(cd ./src/tests && nix flake lock --override-input std git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)) From 4867218beb3587a9f2a3eb0046184e4fb0c3df77 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 25 Aug 2025 17:32:07 +0200 Subject: [PATCH 06/27] feat: update CI to use a new nix version --- .github/workflows/flakehub-publish-tagged.yml | 2 +- flake.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/flakehub-publish-tagged.yml b/.github/workflows/flakehub-publish-tagged.yml index b7a171a6..b2dd4759 100644 --- a/.github/workflows/flakehub-publish-tagged.yml +++ b/.github/workflows/flakehub-publish-tagged.yml @@ -19,7 +19,7 @@ jobs: - uses: "actions/checkout@v3" with: ref: "${{ (inputs.tag != null) && format('refs/tags/{0}', inputs.tag) || '' }}" - - uses: "nixbuild/nix-quick-install-action@v32" + - uses: "DeterminateSystems/nix-installer-action@main" - uses: "DeterminateSystems/flakehub-push@main" with: visibility: "public" diff --git a/flake.nix b/flake.nix index cd96402f..c10129a6 100644 --- a/flake.nix +++ b/flake.nix @@ -70,7 +70,7 @@ inherit (fwlib') blockTypes actions dataWith flakeModule grow growOn findTargets; }; in - assert inputs.nixpkgs.lib.assertMsg ((builtins.compareVersions builtins.nixVersion "2.18") >= 0) "The truth is: you'll need a newer nix version to use Standard (minimum: v2.18)."; + assert inputs.nixpkgs.lib.assertMsg ((builtins.compareVersions builtins.nixVersion "2.23") >= 0) "The truth is: you'll need a newer nix version to use Standard (minimum: v2.23)."; (import ./dogfood.nix (inputs // { std = std // {inherit (inputs.self) narHash;}; From f1a6bc4972162ca1ea21f7d281896bce619626e1 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 25 Aug 2025 17:41:29 +0200 Subject: [PATCH 07/27] fix: use a shallow clone in CI --- .github/workflows/update-subflake.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-subflake.sh b/.github/workflows/update-subflake.sh index d8f2dce6..adb8a0a0 100755 --- a/.github/workflows/update-subflake.sh +++ b/.github/workflows/update-subflake.sh @@ -2,5 +2,5 @@ nix store add-path --name source . # This locks subflakes to the latest commit of std -(cd ./src/local && nix flake lock --override-input std git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)) -(cd ./src/tests && nix flake lock --override-input std git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)) +(cd ./src/local && nix flake lock --override-input std git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)&shallow=1) +(cd ./src/tests && nix flake lock --override-input std git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)&shallow=1) From 1b070da102b6e5fd1745c397b3f810409a106dde Mon Sep 17 00:00:00 2001 From: David Date: Mon, 25 Aug 2025 18:03:11 +0200 Subject: [PATCH 08/27] fix: allow shallow clone of this repo --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index c10129a6..07fcb8dd 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,7 @@ # SPDX-License-Identifier: Unlicense { description = "The Nix Flakes framework for perfectionists with deadlines"; + inputs.self.shallow = true; # override downstream with inputs.std.inputs.nixpkgs.follows = ... inputs.nixpkgs.url = "github:nixos/nixpkgs/release-23.11"; inputs.lib.url = "github:nix-community/nixpkgs.lib"; From 66e142576792fcb3ddd007a4086d63347bd0a9db Mon Sep 17 00:00:00 2001 From: Mayeu Date: Thu, 26 Feb 2026 17:13:55 +0100 Subject: [PATCH 09/27] fix: shallow clone on the repository doesn't work --- flake.nix | 13 ++++++++++++- src/local/flake.lock | 13 ++++++++----- src/tests/flake.lock | 13 ++++++++----- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/flake.nix b/flake.nix index 07fcb8dd..f2a12afd 100644 --- a/flake.nix +++ b/flake.nix @@ -4,7 +4,18 @@ # SPDX-License-Identifier: Unlicense { description = "The Nix Flakes framework for perfectionists with deadlines"; - inputs.self.shallow = true; + # 2026-02-26 @mayeu: I don't understand what it is, and why it's there + # but it doesn't work for me: + # + # ➜ nix --version + # ➜ direnv allow + # error: flake 'self' attribute 'shallow' is not supported + # direnv: The follwing command just failed: + # direnv: nix build --no-update-lock-file --no-write-lock-file --no-warn-dirty --accept-flake-config --no-link --keep-outputs --build-poll-interval 0 --builders-use-substitutes --print-out-paths --profile /Users/m/code-des-autres/std/.data/local/shells/default/enter-action git+file:///Users/m/code-des-autres/std#__std.actions.aarch64-darwin.local.shells.default.enter + # Rerun with --show-trace (y/N): y + # error: flake 'self' attribute 'shallow' is not supported. + # + #inputs.self.shallow = true; # override downstream with inputs.std.inputs.nixpkgs.follows = ... inputs.nixpkgs.url = "github:nixos/nixpkgs/release-23.11"; inputs.lib.url = "github:nix-community/nixpkgs.lib"; diff --git a/src/local/flake.lock b/src/local/flake.lock index 0bbffbb3..927ae7bc 100644 --- a/src/local/flake.lock +++ b/src/local/flake.lock @@ -364,13 +364,16 @@ "yants": "yants" }, "locked": { - "lastModified": 0, - "narHash": "sha256-XnaA3tCS63IMY04wTMqJ5EX47X0fDM9J+0dg6TxXvz8=", - "path": "/nix/store/5pmjinxmq96n3k708s8qii01awbr9w09-source", - "type": "path" + "lastModified": 1772122435, + "narHash": "sha256-V/2MGJfLyt+C188zMjhrgC+jtY7XW4+dPbDB3hzwJHU=", + "ref": "refs/heads/main", + "rev": "1bc369287b12f6378ff2471192255411190167a2", + "revCount": 822, + "type": "git", + "url": "file:///Users/m/code-des-autres/std/src/local/../.." }, "original": { - "path": "/nix/store/5pmjinxmq96n3k708s8qii01awbr9w09-source", + "path": "../../", "type": "path" } }, diff --git a/src/tests/flake.lock b/src/tests/flake.lock index f9f92882..772c8a50 100644 --- a/src/tests/flake.lock +++ b/src/tests/flake.lock @@ -538,13 +538,16 @@ "yants": "yants" }, "locked": { - "lastModified": 0, - "narHash": "sha256-fiGxfoXDVBJzBLpoxPwdM/AcRq/dNIeZLNrMqgmuhNk=", - "path": "/nix/store/b0qrhagsdpgyw9hx9wzrszwsdg5wfnnd-source", - "type": "path" + "lastModified": 1772122435, + "narHash": "sha256-V/2MGJfLyt+C188zMjhrgC+jtY7XW4+dPbDB3hzwJHU=", + "ref": "refs/heads/main", + "rev": "1bc369287b12f6378ff2471192255411190167a2", + "revCount": 822, + "type": "git", + "url": "file:///Users/m/code-des-autres/std/src/tests/../.." }, "original": { - "path": "/nix/store/b0qrhagsdpgyw9hx9wzrszwsdg5wfnnd-source", + "path": "../../", "type": "path" } }, From d692707ad758573ec6d9c47612bf4374241b778b Mon Sep 17 00:00:00 2001 From: "Dr.Teagle" <65212972+DockterTeagle@users.noreply.github.com> Date: Mon, 15 Sep 2025 14:59:23 -0500 Subject: [PATCH 10/27] fix: remove all prettier-toml deps --- src/local/flake.lock | 3 ++- src/tests/flake.lock | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/local/flake.lock b/src/local/flake.lock index 927ae7bc..4eb38a60 100644 --- a/src/local/flake.lock +++ b/src/local/flake.lock @@ -375,7 +375,8 @@ "original": { "path": "../../", "type": "path" - } + }, + "parent": [] }, "systems": { "locked": { diff --git a/src/tests/flake.lock b/src/tests/flake.lock index 772c8a50..6328bd08 100644 --- a/src/tests/flake.lock +++ b/src/tests/flake.lock @@ -549,7 +549,8 @@ "original": { "path": "../../", "type": "path" - } + }, + "parent": [] }, "systems": { "locked": { From 0c9733087e0abb1da0f770ed040f263505754eff Mon Sep 17 00:00:00 2001 From: "Dr.Teagle" <65212972+DockterTeagle@users.noreply.github.com> Date: Mon, 25 Aug 2025 06:30:25 -0500 Subject: [PATCH 11/27] fix: fix prettier --- src/data/configs/mdbook.nix | 1 - src/data/configs/treefmt.nix | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/data/configs/mdbook.nix b/src/data/configs/mdbook.nix index 78e3e0f9..6ff422ac 100644 --- a/src/data/configs/mdbook.nix +++ b/src/data/configs/mdbook.nix @@ -6,7 +6,6 @@ in { packages = [ nixpkgs.alejandra nixpkgs.nodePackages.prettier - nixpkgs.nodePackages.prettier-plugin-toml nixpkgs.shfmt mdbook-paisano-preprocessor ]; diff --git a/src/data/configs/treefmt.nix b/src/data/configs/treefmt.nix index 53fcd5a2..4e77c507 100644 --- a/src/data/configs/treefmt.nix +++ b/src/data/configs/treefmt.nix @@ -5,7 +5,6 @@ in { packages = [ nixpkgs.alejandra nixpkgs.nodePackages.prettier - nixpkgs.nodePackages.prettier-plugin-toml nixpkgs.shfmt ]; @@ -17,7 +16,6 @@ in { }; prettier = { command = lib.getExe nixpkgs.nodePackages.prettier; - options = ["--plugin" "${nixpkgs.nodePackages.prettier-plugin-toml}/lib/node_modules/prettier-plugin-toml/lib/index.js" "--write"]; includes = [ "*.css" "*.html" From e1f68769d63b582e0bed66365597983fd200367b Mon Sep 17 00:00:00 2001 From: Mayeu Date: Thu, 26 Feb 2026 17:32:02 +0100 Subject: [PATCH 12/27] doc: add the PR I merged from divnix/std in this repo --- MERGED_PR | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 MERGED_PR diff --git a/MERGED_PR b/MERGED_PR new file mode 100644 index 00000000..2df77e87 --- /dev/null +++ b/MERGED_PR @@ -0,0 +1,4 @@ +A list of the PRs that I merged from divnix/std in this repo + +- [refactor: change subflake locking to an absolute git locking strategy for compatibility with nix 2.18](https://github.com/divnix/std/pull/418) +- [Fix prettier](https://github.com/divnix/std/pull/419) From 107bdb5dec9daa33c8874ceaf7d3469ef6549545 Mon Sep 17 00:00:00 2001 From: Mayeu Date: Mon, 7 Jul 2025 23:10:24 +0200 Subject: [PATCH 13/27] feat(blocktype/container): pass down $@ to the copy function in the container's publish command --- src/std/fwlib/blockTypes/containers.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/std/fwlib/blockTypes/containers.nix b/src/std/fwlib/blockTypes/containers.nix index 7bdcb043..49641be5 100644 --- a/src/std/fwlib/blockTypes/containers.nix +++ b/src/std/fwlib/blockTypes/containers.nix @@ -62,7 +62,7 @@ in '' {}) (mkCommand currentSystem "publish" "copy the image to its remote registry" [skopeo-nix2container] '' ${copyFn} - copy docker://${target.image.repo} + copy docker://${target.image.repo} "$@" '' { meta.image = target.image.name; inherit proviso; From 48372b2fb50f883e7164ac1facd33e1e0fa8b392 Mon Sep 17 00:00:00 2001 From: Mayeu Date: Thu, 26 Feb 2026 17:33:33 +0100 Subject: [PATCH 14/27] doc: update the list of merged PR --- MERGED_PR | 1 + 1 file changed, 1 insertion(+) diff --git a/MERGED_PR b/MERGED_PR index 2df77e87..fbb0e1a9 100644 --- a/MERGED_PR +++ b/MERGED_PR @@ -2,3 +2,4 @@ A list of the PRs that I merged from divnix/std in this repo - [refactor: change subflake locking to an absolute git locking strategy for compatibility with nix 2.18](https://github.com/divnix/std/pull/418) - [Fix prettier](https://github.com/divnix/std/pull/419) +- [Pass down $@ to the copy function in the container's publish command](https://github.com/divnix/std/pull/421) From 8831fbe4b95c7e09b4cf6e8e2492c988c23f1e34 Mon Sep 17 00:00:00 2001 From: Mayeu Date: Thu, 26 Feb 2026 21:01:48 +0100 Subject: [PATCH 15/27] fix: lefthook need interactive = true to behave correctly --- src/data/configs/lefthook.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/src/data/configs/lefthook.nix b/src/data/configs/lefthook.nix index 1fc1bc05..8ab52958 100644 --- a/src/data/configs/lefthook.nix +++ b/src/data/configs/lefthook.nix @@ -19,6 +19,7 @@ in { treefmt = { run = "${lib.getExe nixpkgs.treefmt} --fail-on-change {staged_files}"; skip = ["merge" "rebase"]; + interactive = true; }; }; }; From 9a17d0b48422a79d29903d8c098f7ce9dabbd092 Mon Sep 17 00:00:00 2001 From: Mayeu Date: Thu, 26 Feb 2026 18:20:18 +0100 Subject: [PATCH 16/27] ci: update checkout action --- .github/workflows/ci.yml | 2 +- .github/workflows/std.yml | 2 +- .github/workflows/update-subflake.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e0c36ef..09126405 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: mac: uses: ./.github/workflows/std.yml with: - runs-on: macOS-13 + runs-on: macOS-latest secrets: inherit linux: diff --git a/.github/workflows/std.yml b/.github/workflows/std.yml index 484b6a3f..1541bd1f 100644 --- a/.github/workflows/std.yml +++ b/.github/workflows/std.yml @@ -23,7 +23,7 @@ jobs: runs-on: ${{ inputs.runs-on }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - uses: nixbuild/nix-quick-install-action@v32 - name: Update subflake references run: ./.github/workflows/update-subflake.sh diff --git a/.github/workflows/update-subflake.sh b/.github/workflows/update-subflake.sh index adb8a0a0..575ba03d 100755 --- a/.github/workflows/update-subflake.sh +++ b/.github/workflows/update-subflake.sh @@ -2,5 +2,5 @@ nix store add-path --name source . # This locks subflakes to the latest commit of std -(cd ./src/local && nix flake lock --override-input std git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)&shallow=1) -(cd ./src/tests && nix flake lock --override-input std git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)&shallow=1) +(cd ./src/local && nix flake lock --override-input std "git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)&shallow=1") +(cd ./src/tests && nix flake lock --override-input std "git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)&shallow=1") From 6426e9458f5b24593b277e34be2bc6aed697fa68 Mon Sep 17 00:00:00 2001 From: Mayeu Date: Thu, 26 Feb 2026 17:21:44 +0100 Subject: [PATCH 17/27] feat: bump nixpkgs, fix namaka, fix .envrc, and add easy to run Makefile commands --- .envrc | 4 ++-- Makefile | 34 ++++++++++++++++++++++++++++++++++ flake.nix | 2 +- src/local/flake.nix | 2 +- 4 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 Makefile diff --git a/.envrc b/.envrc index 6a3d32a9..ef0e0761 100644 --- a/.envrc +++ b/.envrc @@ -1,8 +1,8 @@ #!/bin/sh # This locks subflakes to the latest commit of std -(cd ./src/local && nix flake lock --override-input std git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)) -(cd ./src/tests && nix flake lock --override-input std git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)) +(cd ./src/local && nix flake lock --override-input std "git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)") +(cd ./src/tests && nix flake lock --override-input std "git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)") # shellcheck disable=SC1090 . "$(fetchurl "https://raw.githubusercontent.com/paisano-nix/direnv/main/lib" "sha256-IgQhKK7UHL1AfCUntJO2KCaIDJQotRnK2qC4Daxk+wI=")" diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..1fd0e239 --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +root = $(shell git rev-parse --show-toplevel) +SYSTEM := $(shell nix eval --impure --raw --expr 'builtins.currentSystem') + +update-sub-flake: + cd $(root) + cd src/local && nix flake update + cd src/tests && nix flake update + +ci-local: ci-checks ci-cli ci-shells ci-format + @echo "=== All CI checks passed ===" + +# Not in ci-local by default: dirties flake.lock files, requires committed HEAD. +# Add to ci-local prereqs if full CI parity needed. +ci-sync: + @echo "=== Syncing subflake locks ===" + ./.github/workflows/update-subflake.sh + +ci-checks: + @echo "=== Running checks ===" + nix flake check + +ci-cli: + @echo "=== Building CLI ===" + nix build .#packages.$(SYSTEM).default + +ci-shells: + @echo "=== Building devshells ===" + nix build .#devShells.$(SYSTEM).default --no-link + +ci-format: + @echo "=== Checking formatting ===" + treefmt --fail-on-change + +.PHONY: update-sub-flake ci-local ci-sync ci-checks ci-cli ci-shells ci-format diff --git a/flake.nix b/flake.nix index f2a12afd..129e4659 100644 --- a/flake.nix +++ b/flake.nix @@ -17,7 +17,7 @@ # #inputs.self.shallow = true; # override downstream with inputs.std.inputs.nixpkgs.follows = ... - inputs.nixpkgs.url = "github:nixos/nixpkgs/release-23.11"; + inputs.nixpkgs.url = "github:nixos/nixpkgs/release-25.11"; inputs.lib.url = "github:nix-community/nixpkgs.lib"; inputs = { paisano.url = "github:paisano-nix/core/0.2.0"; diff --git a/src/local/flake.nix b/src/local/flake.nix index 6315a203..ead23fbd 100644 --- a/src/local/flake.nix +++ b/src/local/flake.nix @@ -1,7 +1,7 @@ { inputs = { # injected (private) inputs - namaka.url = "github:nix-community/namaka/v0.2.0"; + namaka.url = "github:nix-community/namaka/v0.2.1"; namaka.inputs.haumea.follows = "std/haumea"; namaka.inputs.nixpkgs.follows = "std/nixpkgs"; From 4a143a9d5f21be92b286163ab4402dbfd617a8db Mon Sep 17 00:00:00 2001 From: Mayeu Date: Thu, 26 Feb 2026 17:21:44 +0100 Subject: [PATCH 18/27] feat: nix flake update --- flake.lock | 14 +-- src/local/flake.lock | 87 ++++++------------- src/tests/flake.lock | 198 ++++++++++++++++++------------------------- 3 files changed, 116 insertions(+), 183 deletions(-) diff --git a/flake.lock b/flake.lock index 38b25174..6dd9b2fc 100644 --- a/flake.lock +++ b/flake.lock @@ -100,11 +100,11 @@ }, "lib": { "locked": { - "lastModified": 1722128034, - "narHash": "sha256-L8rwzYPsLo/TYtydPJoQyYOfetuiyQYnTWYcyB8UE/s=", + "lastModified": 1771723719, + "narHash": "sha256-e+/T/pmEkLP6BHhYjx6GmwP5ivonQQn0bJdH9YrRB+Q=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "d15f6f6021693898fcd2c6a9bb13707383da9bbc", + "rev": "36b8fcb216736b0e1869740b324ae521e5df23d8", "type": "github" }, "original": { @@ -115,16 +115,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1720535198, - "narHash": "sha256-zwVvxrdIzralnSbcpghA92tWu2DV2lwv89xZc8MTrbg=", + "lastModified": 1772126089, + "narHash": "sha256-btWE4hUI+cQvBG3b8H5pan+v1fYEm88LmogbRZjXOdw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "205fd4226592cc83fd4c0885a3e4c9c400efabb5", + "rev": "3b7080affa3142f035891aabab1e568fd444c7e5", "type": "github" }, "original": { "owner": "nixos", - "ref": "release-23.11", + "ref": "release-25.11", "repo": "nixpkgs", "type": "github" } diff --git a/src/local/flake.lock b/src/local/flake.lock index 4eb38a60..0e0fe0a4 100644 --- a/src/local/flake.lock +++ b/src/local/flake.lock @@ -35,15 +35,14 @@ "nixpkgs": [ "std", "nixpkgs" - ], - "systems": "systems" + ] }, "locked": { - "lastModified": 1687173957, - "narHash": "sha256-GOds2bAQcZ94fb9/Nl/aM+r+0wGSi4EKYuZYR8Dw4R8=", + "lastModified": 1768818222, + "narHash": "sha256-460jc0+CZfyaO8+w8JNtlClB2n4ui1RbHfPTLkpwhU8=", "owner": "numtide", "repo": "devshell", - "rev": "2cf83bb31720fcc29a999aee28d6da101173e66a", + "rev": "255a2b1725a20d060f566e4755dbf571bbbb5f76", "type": "github" }, "original": { @@ -97,21 +96,6 @@ "type": "github" } }, - "flake-utils_2": { - "locked": { - "lastModified": 1653893745, - "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "haumea": { "inputs": { "nixpkgs": [ @@ -157,11 +141,11 @@ }, "lib": { "locked": { - "lastModified": 1722128034, - "narHash": "sha256-L8rwzYPsLo/TYtydPJoQyYOfetuiyQYnTWYcyB8UE/s=", + "lastModified": 1771723719, + "narHash": "sha256-e+/T/pmEkLP6BHhYjx6GmwP5ivonQQn0bJdH9YrRB+Q=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "d15f6f6021693898fcd2c6a9bb13707383da9bbc", + "rev": "36b8fcb216736b0e1869740b324ae521e5df23d8", "type": "github" }, "original": { @@ -172,18 +156,17 @@ }, "n2c": { "inputs": { - "flake-utils": "flake-utils", "nixpkgs": [ "std", "nixpkgs" ] }, "locked": { - "lastModified": 1685771919, - "narHash": "sha256-3lVKWrhNXjHJB6QkZ2SJaOs4X/mmYXtY6ovPVpDMOHc=", + "lastModified": 1767430085, + "narHash": "sha256-SiXJ6xv4pS2MDUqfj0/mmG746cGeJrMQGmoFgHLS25Y=", "owner": "nlewo", "repo": "nix2container", - "rev": "95e2220911874064b5d809f8d35f7835184c4ddf", + "rev": "66f4b8a47e92aa744ec43acbb5e9185078983909", "type": "github" }, "original": { @@ -204,23 +187,23 @@ ] }, "locked": { - "lastModified": 1685739139, - "narHash": "sha256-CLGEW11Fo1v4vj0XSqiyW1EbhRZFO7dkgM43eKwItrk=", + "lastModified": 1731804449, + "narHash": "sha256-1ka+5B90UAt7D5kkT9dOExGLJjtLM8dqLeBdFRoeuWg=", "owner": "nix-community", "repo": "namaka", - "rev": "d9a2cc83c1d0f68bd613f1fc909d0ef2cfffcf2e", + "rev": "6a8f92b7963e772adee605f7e1a683ad92df0190", "type": "github" }, "original": { "owner": "nix-community", - "ref": "v0.2.0", + "ref": "v0.2.1", "repo": "namaka", "type": "github" } }, "nixago": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils", "nixago-exts": [], "nixpkgs": [ "std", @@ -228,11 +211,11 @@ ] }, "locked": { - "lastModified": 1687381756, - "narHash": "sha256-IUMIlYfrvj7Yli4H2vvyig8HEPpfCeMaE6+kBGPzFyk=", + "lastModified": 1746801636, + "narHash": "sha256-dlcKfIXp/eqFHzFm+DzseXAWWlpVwyk9cTvCKGtVKkw=", "owner": "nix-community", "repo": "nixago", - "rev": "dacceb10cace103b3e66552ec9719fa0d33c0dc9", + "rev": "8cc33f973ab3a891d8a41391e73ef451a783960b", "type": "github" }, "original": { @@ -243,16 +226,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1720535198, - "narHash": "sha256-zwVvxrdIzralnSbcpghA92tWu2DV2lwv89xZc8MTrbg=", + "lastModified": 1772126089, + "narHash": "sha256-btWE4hUI+cQvBG3b8H5pan+v1fYEm88LmogbRZjXOdw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "205fd4226592cc83fd4c0885a3e4c9c400efabb5", + "rev": "3b7080affa3142f035891aabab1e568fd444c7e5", "type": "github" }, "original": { "owner": "nixos", - "ref": "release-23.11", + "ref": "release-25.11", "repo": "nixpkgs", "type": "github" } @@ -364,33 +347,17 @@ "yants": "yants" }, "locked": { - "lastModified": 1772122435, - "narHash": "sha256-V/2MGJfLyt+C188zMjhrgC+jtY7XW4+dPbDB3hzwJHU=", - "ref": "refs/heads/main", - "rev": "1bc369287b12f6378ff2471192255411190167a2", - "revCount": 822, + "lastModified": 1772127938, + "narHash": "sha256-peYU8Fd5qYKMZpBMxKWFW6UHq+Qf8fLR2kpcQ8irBTw=", + "ref": "refs/heads/fix/upgrade-flake-lock", + "rev": "7c75c6d51d37fd4c7567ed0159497470d77e9c73", + "revCount": 836, "type": "git", "url": "file:///Users/m/code-des-autres/std/src/local/../.." }, "original": { "path": "../../", "type": "path" - }, - "parent": [] - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" } }, "yants": { diff --git a/src/tests/flake.lock b/src/tests/flake.lock index 6328bd08..6c48845a 100644 --- a/src/tests/flake.lock +++ b/src/tests/flake.lock @@ -10,11 +10,11 @@ ] }, "locked": { - "lastModified": 1682181677, - "narHash": "sha256-El8WQ2ccxWwkSrjuwKNR0gD/O7vS/KLBY4Q2/nF8m1c=", + "lastModified": 1770259557, + "narHash": "sha256-EvZ09k9+mzXAngPzU2K7oLLUDlKoT1numb4bDb3Gtl4=", "owner": "hercules-ci", "repo": "arion", - "rev": "6a1f03329c400327b3b2e0ed5e1efff11037ba67", + "rev": "9b24cf65c72cb0e9616e437d55e1ac8e5c6bc715", "type": "github" }, "original": { @@ -58,15 +58,14 @@ "nixpkgs": [ "std", "nixpkgs" - ], - "systems": "systems" + ] }, "locked": { - "lastModified": 1687173957, - "narHash": "sha256-GOds2bAQcZ94fb9/Nl/aM+r+0wGSi4EKYuZYR8Dw4R8=", + "lastModified": 1768818222, + "narHash": "sha256-460jc0+CZfyaO8+w8JNtlClB2n4ui1RbHfPTLkpwhU8=", "owner": "numtide", "repo": "devshell", - "rev": "2cf83bb31720fcc29a999aee28d6da101173e66a", + "rev": "255a2b1725a20d060f566e4755dbf571bbbb5f76", "type": "github" }, "original": { @@ -113,11 +112,11 @@ ] }, "locked": { - "lastModified": 1675933616, - "narHash": "sha256-/rczJkJHtx16IFxMmAWu5nNYcSXNg1YYXTHoGjLrLUA=", + "lastModified": 1769996383, + "narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "47478a4a003e745402acf63be7f9a092d51b83d7", + "rev": "57928607ea566b5db3ad13af0e57e921e6b12381", "type": "github" }, "original": { @@ -131,11 +130,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1685662779, - "narHash": "sha256-cKDDciXGpMEjP1n6HlzKinN0H+oLmNpgeCTzYnsA2po=", + "lastModified": 1769996383, + "narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "71fb97f0d875fd4de4994dfb849f2c75e17eb6c3", + "rev": "57928607ea566b5db3ad13af0e57e921e6b12381", "type": "github" }, "original": { @@ -144,40 +143,28 @@ "type": "github" } }, - "flake-utils": { + "flake-parts_3": { "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", - "type": "github" + "nixpkgs-lib": [ + "terranix", + "nixpkgs" + ] }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_2": { "locked": { - "lastModified": 1653893745, - "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "lastModified": 1736143030, + "narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "hercules-ci", + "repo": "flake-parts", "type": "github" } }, - "flake-utils_3": { + "flake-utils": { "locked": { "lastModified": 1653893745, "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", @@ -192,21 +179,6 @@ "type": "github" } }, - "flake-utils_4": { - "locked": { - "lastModified": 1634851050, - "narHash": "sha256-N83GlSGPJJdcqhUxSCS/WwW5pksYf3VP1M13cDRTSVA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c91f3de5adaf1de973b797ef7485e441a65b8935", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "haskell-flake": { "locked": { "lastModified": 1675296942, @@ -268,11 +240,11 @@ }, "lib": { "locked": { - "lastModified": 1722128034, - "narHash": "sha256-L8rwzYPsLo/TYtydPJoQyYOfetuiyQYnTWYcyB8UE/s=", + "lastModified": 1771723719, + "narHash": "sha256-e+/T/pmEkLP6BHhYjx6GmwP5ivonQQn0bJdH9YrRB+Q=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "d15f6f6021693898fcd2c6a9bb13707383da9bbc", + "rev": "36b8fcb216736b0e1869740b324ae521e5df23d8", "type": "github" }, "original": { @@ -289,11 +261,11 @@ ] }, "locked": { - "lastModified": 1687381438, - "narHash": "sha256-fdN+9as0dGFR+S5Ea6hqLtNhiy52kPaZuGlRGxlyQZY=", + "lastModified": 1753906051, + "narHash": "sha256-86UR4dRNR9WGnWV/r2MR8X+3NC5gwROlX6+yqxbbXjA=", "owner": "fluidattacks", "repo": "makes", - "rev": "78993b56802419ba5e56c22471a12349e66be47b", + "rev": "9123a55ab84b57fe08bb33379b92fe3922e71408", "type": "github" }, "original": { @@ -304,18 +276,18 @@ }, "microvm": { "inputs": { - "flake-utils": "flake-utils", "nixpkgs": [ "std", "nixpkgs" - ] + ], + "spectrum": "spectrum" }, "locked": { - "lastModified": 1687369979, - "narHash": "sha256-pSkc15k9yug3vwnri5quvi0R6LHR4u7J0/8FkTpFlmQ=", + "lastModified": 1772055583, + "narHash": "sha256-iPIm1orqkhsxqju6EVODOrV1BmyA5HNTZ8a1o812bFM=", "owner": "astro", "repo": "microvm.nix", - "rev": "c14833d8506a784f0b3cf91a2b864acb05662711", + "rev": "f6dcfb7c16cc3775536c825dc0698d4ede13d063", "type": "github" }, "original": { @@ -326,18 +298,17 @@ }, "n2c": { "inputs": { - "flake-utils": "flake-utils_2", "nixpkgs": [ "std", "nixpkgs" ] }, "locked": { - "lastModified": 1685771919, - "narHash": "sha256-3lVKWrhNXjHJB6QkZ2SJaOs4X/mmYXtY6ovPVpDMOHc=", + "lastModified": 1767430085, + "narHash": "sha256-SiXJ6xv4pS2MDUqfj0/mmG746cGeJrMQGmoFgHLS25Y=", "owner": "nlewo", "repo": "nix2container", - "rev": "95e2220911874064b5d809f8d35f7835184c4ddf", + "rev": "66f4b8a47e92aa744ec43acbb5e9185078983909", "type": "github" }, "original": { @@ -374,7 +345,7 @@ }, "nixago": { "inputs": { - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils", "nixago-exts": [], "nixpkgs": [ "std", @@ -382,11 +353,11 @@ ] }, "locked": { - "lastModified": 1687381756, - "narHash": "sha256-IUMIlYfrvj7Yli4H2vvyig8HEPpfCeMaE6+kBGPzFyk=", + "lastModified": 1746801636, + "narHash": "sha256-dlcKfIXp/eqFHzFm+DzseXAWWlpVwyk9cTvCKGtVKkw=", "owner": "nix-community", "repo": "nixago", - "rev": "dacceb10cace103b3e66552ec9719fa0d33c0dc9", + "rev": "8cc33f973ab3a891d8a41391e73ef451a783960b", "type": "github" }, "original": { @@ -397,35 +368,32 @@ }, "nixpkgs": { "locked": { - "lastModified": 1720535198, - "narHash": "sha256-zwVvxrdIzralnSbcpghA92tWu2DV2lwv89xZc8MTrbg=", + "lastModified": 1772126089, + "narHash": "sha256-btWE4hUI+cQvBG3b8H5pan+v1fYEm88LmogbRZjXOdw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "205fd4226592cc83fd4c0885a3e4c9c400efabb5", + "rev": "3b7080affa3142f035891aabab1e568fd444c7e5", "type": "github" }, "original": { "owner": "nixos", - "ref": "release-23.11", + "ref": "release-25.11", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-lib": { "locked": { - "dir": "lib", - "lastModified": 1685564631, - "narHash": "sha256-8ywr3AkblY4++3lIVxmrWZFzac7+f32ZEhH/A8pNscI=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "4f53efe34b3a8877ac923b9350c874e3dcd5dc0a", + "lastModified": 1769909678, + "narHash": "sha256-cBEymOf4/o3FD5AZnzC3J9hLbiZ+QDT/KDuyHXVJOpM=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "72716169fe93074c333e8d0173151350670b824c", "type": "github" }, "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", + "owner": "nix-community", + "repo": "nixpkgs.lib", "type": "github" } }, @@ -503,6 +471,22 @@ "terranix": "terranix" } }, + "spectrum": { + "flake": false, + "locked": { + "lastModified": 1759482047, + "narHash": "sha256-H1wiXRQHxxPyMMlP39ce3ROKCwI5/tUn36P8x6dFiiQ=", + "ref": "refs/heads/main", + "rev": "c5d5786d3dc938af0b279c542d1e43bce381b4b9", + "revCount": 996, + "type": "git", + "url": "https://spectrum-os.org/git/spectrum" + }, + "original": { + "type": "git", + "url": "https://spectrum-os.org/git/spectrum" + } + }, "std": { "inputs": { "arion": [ @@ -538,36 +522,20 @@ "yants": "yants" }, "locked": { - "lastModified": 1772122435, - "narHash": "sha256-V/2MGJfLyt+C188zMjhrgC+jtY7XW4+dPbDB3hzwJHU=", - "ref": "refs/heads/main", - "rev": "1bc369287b12f6378ff2471192255411190167a2", - "revCount": 822, + "lastModified": 1772127938, + "narHash": "sha256-peYU8Fd5qYKMZpBMxKWFW6UHq+Qf8fLR2kpcQ8irBTw=", + "ref": "refs/heads/fix/upgrade-flake-lock", + "rev": "7c75c6d51d37fd4c7567ed0159497470d77e9c73", + "revCount": 836, "type": "git", "url": "file:///Users/m/code-des-autres/std/src/tests/../.." }, "original": { "path": "../../", "type": "path" - }, - "parent": [] - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" } }, - "systems_2": { + "systems": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -584,21 +552,19 @@ }, "terranix": { "inputs": { - "bats-assert": [], - "bats-support": [], - "flake-utils": "flake-utils_4", + "flake-parts": "flake-parts_3", "nixpkgs": [ "std", "nixpkgs" ], - "terranix-examples": [] + "systems": "systems" }, "locked": { - "lastModified": 1684906298, - "narHash": "sha256-pNuJxmVMGbBHw7pa+Bx0HY0orXIXoyyAXOKuQ1zpfus=", + "lastModified": 1772084625, + "narHash": "sha256-NHVyzvrcMEnRU8pp9ATTfn4+QPQT50leQg5JFbM+pz0=", "owner": "terranix", "repo": "terranix", - "rev": "c0dd15076856c6cb425795b8c7d5d37d3a1e922a", + "rev": "56f22d4c477a552d2aa13bfa6251ff34e7c05ce2", "type": "github" }, "original": { From 211e383e2f50d3bd5972e836bbda55f72c8bc38b Mon Sep 17 00:00:00 2001 From: Mayeu Date: Thu, 26 Feb 2026 19:00:45 +0100 Subject: [PATCH 19/27] chore: format codebase --- .../blockTypes/_postDiffToGitHubSnippet.nix | 102 +++++++++--------- .../fwlib/blockTypes/containers-proviso.sh | 2 +- src/std/fwlib/blockTypes/devshells.nix | 2 +- src/std/fwlib/blockTypes/terra.nix | 7 +- src/std/fwlib/flakeModule.nix | 12 +-- tests/bt-blocktypes/expr.nix | 11 +- tests/cells-lib-cfg/expr.nix | 7 +- tests/cells-lib-dev/expr.nix | 4 +- tests/cells-lib-ops/expr.nix | 4 +- 9 files changed, 81 insertions(+), 70 deletions(-) diff --git a/src/std/fwlib/blockTypes/_postDiffToGitHubSnippet.nix b/src/std/fwlib/blockTypes/_postDiffToGitHubSnippet.nix index 92f3906f..a5f3d223 100644 --- a/src/std/fwlib/blockTypes/_postDiffToGitHubSnippet.nix +++ b/src/std/fwlib/blockTypes/_postDiffToGitHubSnippet.nix @@ -1,70 +1,70 @@ _: marker: diff_output: summary: '' - if [[ -v CI ]] && [[ -v BRANCH ]] && [[ -v OWNER_AND_REPO ]] && command -v gh > /dev/null ; then + if [[ -v CI ]] && [[ -v BRANCH ]] && [[ -v OWNER_AND_REPO ]] && command -v gh > /dev/null ; then - OWNER_REPO_NAME=$(gh repo view "$OWNER_AND_REPO" --json nameWithOwner --jq '.nameWithOwner') + OWNER_REPO_NAME=$(gh repo view "$OWNER_AND_REPO" --json nameWithOwner --jq '.nameWithOwner') - if ! gh pr view "$BRANCH" --repo "$OWNER_REPO_NAME" >/dev/null 2>&1; then - exit 0 - fi - - # Proceed only if there is output - if [[ -z "${diff_output}" ]]; then - exit 0 - fi + if ! gh pr view "$BRANCH" --repo "$OWNER_REPO_NAME" >/dev/null 2>&1; then + exit 0 + fi - CENTRAL_COMMENT_HEADER="" - ENTRY_START_MARKER="" - ENTRY_END_MARKER="" + # Proceed only if there is output + if [[ -z "${diff_output}" ]]; then + exit 0 + fi - # Use the provided summary - DIFF_ENTRY=$(cat < -${summary} + # Use the provided summary + DIFF_ENTRY=$(cat < + ${summary} - -$ENTRY_END_MARKER -EOF - ) + \`\`\`diff + ${diff_output} + \`\`\` - PR_NUMBER=$(gh pr view "$BRANCH" --repo "$OWNER_REPO_NAME" --json number --jq '.number') + + $ENTRY_END_MARKER + EOF + ) - EXISTING_COMMENT_ID=$(gh api "repos/$OWNER_REPO_NAME/issues/$PR_NUMBER/comments?per_page=100" --jq ".[] | select(.body | contains(\"$CENTRAL_COMMENT_HEADER\")) | .id" | head -n 1) + PR_NUMBER=$(gh pr view "$BRANCH" --repo "$OWNER_REPO_NAME" --json number --jq '.number') - if [[ -n "$EXISTING_COMMENT_ID" ]]; then - EXISTING_BODY=$(gh api "repos/$OWNER_REPO_NAME/issues/comments/$EXISTING_COMMENT_ID" --jq '.body') + EXISTING_COMMENT_ID=$(gh api "repos/$OWNER_REPO_NAME/issues/$PR_NUMBER/comments?per_page=100" --jq ".[] | select(.body | contains(\"$CENTRAL_COMMENT_HEADER\")) | .id" | head -n 1) - if echo "$EXISTING_BODY" | grep -q "$ENTRY_START_MARKER"; then - UPDATED_BODY=$(echo "$EXISTING_BODY" | sed -e "\#$ENTRY_START_MARKER#,\#$ENTRY_END_MARKER#d") - else - UPDATED_BODY="$EXISTING_BODY" - fi + if [[ -n "$EXISTING_COMMENT_ID" ]]; then + EXISTING_BODY=$(gh api "repos/$OWNER_REPO_NAME/issues/comments/$EXISTING_COMMENT_ID" --jq '.body') - UPDATED_BODY="$UPDATED_BODY -$DIFF_ENTRY" + if echo "$EXISTING_BODY" | grep -q "$ENTRY_START_MARKER"; then + UPDATED_BODY=$(echo "$EXISTING_BODY" | sed -e "\#$ENTRY_START_MARKER#,\#$ENTRY_END_MARKER#d") + else + UPDATED_BODY="$EXISTING_BODY" + fi - echo "Updating existing comment..." - gh api --method PATCH "repos/$OWNER_REPO_NAME/issues/comments/$EXISTING_COMMENT_ID" -f body="$UPDATED_BODY" --jq '.html_url' + UPDATED_BODY="$UPDATED_BODY + $DIFF_ENTRY" - else - NEW_COMMENT=$(cat </dev/null; then exit 1 diff --git a/src/std/fwlib/blockTypes/devshells.nix b/src/std/fwlib/blockTypes/devshells.nix index 00c292ee..8f1e56f4 100644 --- a/src/std/fwlib/blockTypes/devshells.nix +++ b/src/std/fwlib/blockTypes/devshells.nix @@ -1,4 +1,4 @@ -{ +{ root, super, }: diff --git a/src/std/fwlib/blockTypes/terra.nix b/src/std/fwlib/blockTypes/terra.nix index c9116bf2..c054c273 100644 --- a/src/std/fwlib/blockTypes/terra.nix +++ b/src/std/fwlib/blockTypes/terra.nix @@ -84,18 +84,17 @@ in --state ${git.state} \ terraform ${cmd} "$@" \ ${pkgs.lib.optionalString (cmd == "plan") '' - -lock=false -no-color | tee "$PRJ_CACHE_HOME/tf.console.txt" - ''} + -lock=false -no-color | tee "$PRJ_CACHE_HOME/tf.console.txt" + ''} # Pass output to the snippet ${pkgs.lib.optionalString (cmd == "plan") '' output=$(cat "$PRJ_CACHE_HOME/tf.console.txt") summary_plan=$(tac "$PRJ_CACHE_HOME/tf.console.txt" | grep -m 1 -E '^(Error:|Plan:|Apply complete!|No changes.|Success)' | tac || echo "View output.") - summary="std ${fragmentRelPath}:${cmd}: $summary_plan" + summary="std ${fragmentRelPath}:${cmd}: $summary_plan" ${postDiffToGitHubSnippet "${fragmentRelPath}:${cmd}" "$output" "$summary"} ''} ''; - in [ (mkCommand currentSystem "init" "tf init" [pkgs.jq pkgs.terraform pkgs.terraform-backend-git] (wrap "init") {}) (mkCommand currentSystem "plan" "tf plan" [pkgs.jq pkgs.terraform pkgs.terraform-backend-git] (wrap "plan") {}) diff --git a/src/std/fwlib/flakeModule.nix b/src/std/fwlib/flakeModule.nix index 2fc5d9bc..462a6bd7 100644 --- a/src/std/fwlib/flakeModule.nix +++ b/src/std/fwlib/flakeModule.nix @@ -168,12 +168,12 @@ in }; config = { flake = let - grown = grow ({ - inherit inputs; - inherit (config) systems; - # access them explicitly to trigger a module system error if not defined - inherit (cfg.grow) cellsFrom cellBlocks nixpkgsConfig; - }); + grown = grow { + inherit inputs; + inherit (config) systems; + # access them explicitly to trigger a module system error if not defined + inherit (cfg.grow) cellsFrom cellBlocks nixpkgsConfig; + }; picked = mapAttrs (_: v: pick grown v) cfg.pick; harvested = mapAttrs (_: v: harvest grown v) cfg.harvest; winnowed = zipAttrsWith (n: v: winnow (head v) grown (head (tail v))) [cfg.winnowIf cfg.winnow]; diff --git a/tests/bt-blocktypes/expr.nix b/tests/bt-blocktypes/expr.nix index 1fb80e3f..d2c3dbba 100644 --- a/tests/bt-blocktypes/expr.nix +++ b/tests/bt-blocktypes/expr.nix @@ -69,8 +69,11 @@ removeAttrs ({ terra = f n "myrepo"; } - .${n} - or (f n)) ["__functor"]; + .${ + n + } + or (f + n)) ["__functor"]; # fake snapshot compliance across systems FakeActionsForOtherSystems = let fakeDrv = name: @@ -115,7 +118,9 @@ in ( dmerge {${n} = actions';} FakeActionsForOtherSystems ) - .${n}; + .${ + n + }; in pipe r [ (map trimProvisoPath) diff --git a/tests/cells-lib-cfg/expr.nix b/tests/cells-lib-cfg/expr.nix index 0bbdf1e5..399faf0b 100644 --- a/tests/cells-lib-cfg/expr.nix +++ b/tests/cells-lib-cfg/expr.nix @@ -16,8 +16,11 @@ in tasks = {}; }; } - .${n} - or {}; + .${ + n + } + or { + }; } ) .configFile diff --git a/tests/cells-lib-dev/expr.nix b/tests/cells-lib-dev/expr.nix index 8a00bdc0..9065a2c5 100644 --- a/tests/cells-lib-dev/expr.nix +++ b/tests/cells-lib-dev/expr.nix @@ -17,7 +17,9 @@ in .out .dockerComposeYaml; } - .${n} + .${ + n + } or "missing-test" ) dev diff --git a/tests/cells-lib-ops/expr.nix b/tests/cells-lib-ops/expr.nix index 5d611baf..da7ad8d0 100644 --- a/tests/cells-lib-ops/expr.nix +++ b/tests/cells-lib-ops/expr.nix @@ -28,7 +28,9 @@ in devshell = dev.mkShell {name = "Test";}; }; } - .${n} + .${ + n + } or "missing-test" ) ops From 43c19912a1f6df0fd3fe30f4e0531220f3641800 Mon Sep 17 00:00:00 2001 From: Mayeu Date: Thu, 26 Feb 2026 21:03:59 +0100 Subject: [PATCH 20/27] feat: add makefile target to run the 'ci' on linux as well --- Makefile | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1fd0e239..67845108 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ root = $(shell git rev-parse --show-toplevel) SYSTEM := $(shell nix eval --impure --raw --expr 'builtins.currentSystem') +LINUX := x86_64-linux +DARWIN := aarch64-darwin update-sub-flake: cd $(root) @@ -9,6 +11,9 @@ update-sub-flake: ci-local: ci-checks ci-cli ci-shells ci-format @echo "=== All CI checks passed ===" +ci-all: ci-checks-all ci-cli-all ci-shells-all ci-format + @echo "=== All CI checks passed (all systems) ===" + # Not in ci-local by default: dirties flake.lock files, requires committed HEAD. # Add to ci-local prereqs if full CI parity needed. ci-sync: @@ -17,18 +22,46 @@ ci-sync: ci-checks: @echo "=== Running checks ===" - nix flake check + nix build .#checks.$(SYSTEM) --no-link + +ci-checks-all: ci-checks-linux ci-checks-darwin +ci-checks-linux: + @echo "=== Running checks (linux) ===" + nix build .#checks.$(LINUX) --no-link +ci-checks-darwin: + @echo "=== Running checks (darwin) ===" + nix build .#checks.$(DARWIN) --no-link ci-cli: @echo "=== Building CLI ===" nix build .#packages.$(SYSTEM).default +ci-cli-all: ci-cli-linux ci-cli-darwin +ci-cli-linux: + @echo "=== Building CLI (linux) ===" + nix build .#packages.$(LINUX).default +ci-cli-darwin: + @echo "=== Building CLI (darwin) ===" + nix build .#packages.$(DARWIN).default + ci-shells: @echo "=== Building devshells ===" nix build .#devShells.$(SYSTEM).default --no-link +ci-shells-all: ci-shells-linux ci-shells-darwin +ci-shells-linux: + @echo "=== Building devshells (linux) ===" + nix build .#devShells.$(LINUX).default --no-link +ci-shells-darwin: + @echo "=== Building devshells (darwin) ===" + nix build .#devShells.$(DARWIN).default --no-link + ci-format: @echo "=== Checking formatting ===" treefmt --fail-on-change -.PHONY: update-sub-flake ci-local ci-sync ci-checks ci-cli ci-shells ci-format +.PHONY: update-sub-flake ci-local ci-all ci-sync +.PHONY: ci-checks ci-checks-all ci-checks-linux ci-checks-darwin +.PHONY: ci-cli ci-cli-all ci-cli-linux ci-cli-darwin +.PHONY: ci-shells ci-shells-all ci-shells-linux ci-shells-darwin +.PHONY: ci-format From fadfccdcde1bb71e6ec01cfa783d27a02a419e6d Mon Sep 17 00:00:00 2001 From: Mayeu Date: Thu, 26 Feb 2026 21:13:31 +0100 Subject: [PATCH 21/27] fix: terranix --- src/std/fwlib/blockTypes/terra.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/std/fwlib/blockTypes/terra.nix b/src/std/fwlib/blockTypes/terra.nix index c054c273..4d6fb896 100644 --- a/src/std/fwlib/blockTypes/terra.nix +++ b/src/std/fwlib/blockTypes/terra.nix @@ -47,10 +47,12 @@ in terraformConfiguration = builtins.toFile "config.tf.json" (builtins.toJSON (terraEval { inherit pkgs; # only effectively required for `pkgs.lib` - terranix_config = { - _file = fragmentRelPath; - imports = [target]; - }; + modules = [ + { + _file = fragmentRelPath; + imports = [target]; + } + ]; strip_nulls = true; }) .config); From 48b9cbe26aadd79301f78f56fe02e7823f25ce1a Mon Sep 17 00:00:00 2001 From: Mayeu Date: Thu, 26 Feb 2026 21:14:29 +0100 Subject: [PATCH 22/27] fix: gofmt should be the one in nixpkgs --- src/local/configs.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/local/configs.nix b/src/local/configs.nix index e075208c..c09dfbb2 100644 --- a/src/local/configs.nix +++ b/src/local/configs.nix @@ -18,7 +18,7 @@ in { global.excludes = ["src/std/templates/**"]; formatter = { go = { - command = "gofmt"; + command = "${nixpkgs.go}/bin/gofmt"; options = ["-w"]; includes = ["*.go"]; }; From ae0953bf70322829b41633abf2cebb09d8a417ae Mon Sep 17 00:00:00 2001 From: Mayeu Date: Thu, 26 Feb 2026 21:25:06 +0100 Subject: [PATCH 23/27] fix: update check-augmented-cell-inputs snapshot for new flake.lock --- tests/_snapshots/check-augmented-cell-inputs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/_snapshots/check-augmented-cell-inputs b/tests/_snapshots/check-augmented-cell-inputs index 126630fa..88c3f073 100644 --- a/tests/_snapshots/check-augmented-cell-inputs +++ b/tests/_snapshots/check-augmented-cell-inputs @@ -1,22 +1,22 @@ #pretty { - arion = "/nix/store/8px6k532a5fvz0k7ckhj3kfyqxbhz317-source"; + arion = "/nix/store/jq98iqdcqyyfarjmkbnzjnk50rdvlpja-source"; blank = "/nix/store/scflkbbsqxlzxvja3gm4xf1y2kvsww32-source"; cells = "no .outPath"; - devshell = "/nix/store/gadmzrrq2dygvzy3yqp5x7gfbd7l2pw1-source"; + devshell = "/nix/store/hh6i9rnxx1v6azzva6dc3ivglh9bxnzg-source"; dmerge = "/nix/store/8b67fxqldqv1x3x07nhabb9ild2zl6rz-source"; - flake-parts = "/nix/store/jiyanhix45y0a7m9nsrng44yjzrp79m9-source"; + flake-parts = "/nix/store/j5qcw5x2dm0jlffwwymp6yav62l3pdqm-source"; haumea = "/nix/store/ih873qmabdsdgk1naaiv6v7jy1mxq241-source"; incl = "/nix/store/9yriyvqkcvhqwizwdbsblk3pp0dkgim2-source"; - lib = "/nix/store/0vvdgp2wdj9q0kqgakgax3bwhkd152rx-source"; - makes = "/nix/store/71rzg7vs53gmxqph64d9zqf4ns928c6c-source"; - microvm = "/nix/store/v5za7dzczgcvfvqgcm80qari3msyhw6b-source"; - n2c = "/nix/store/rgd4s5ylv38p94wi6vays6wc1a0l5iyf-source"; + lib = "/nix/store/hz9wgm1chlnk6yj9i3gsqrx8k361j5h5-source"; + makes = "/nix/store/c1silm3bs5g86rvhmjz8vm2lmgjnchzw-source"; + microvm = "/nix/store/d5jjdll38cv7w85mb8v40r0y4n7k6zmw-source"; + n2c = "/nix/store/m0m72b7nj91pfyfbblzhi7k7c2cxpb6b-source"; namaka = "/nix/store/prb836vl3r64l97045clfli0d5m5fyap-source"; - nixago = "/nix/store/cys15p6lyyhj85bk4bckn82waih2l945-source"; - nixpkgs = "/nix/store/g8zzlf6drg73c987ii390yicq4c0j778-source"; + nixago = "/nix/store/6pb5g5b93dg3fvcys8pq9b0baj4k11mj-source"; + nixpkgs = "/nix/store/4jrlc8a5798jx9l5pvgv002jvq9iz6wy-source"; paisano = "/nix/store/4v8nn2z2vl74yz1557n1dha3l7rzzbgs-source"; paisano-tui = "/nix/store/rdrvzcs8j77fccnkky6p2sagc0d49hyy-source"; - terranix = "/nix/store/agasgh0qgqi0fxk3zzgrjvqpx6k8036c-source"; + terranix = "/nix/store/p35a0z78v1nq298nwzlq8vvc6r2qzxf4-source"; yants = "/nix/store/np6pvhkza8grv26qypzpibwrrg7kqxkc-source"; } \ No newline at end of file From bd6134471fd3df71290c0f5e6e5688cb3f93bc8b Mon Sep 17 00:00:00 2001 From: Mayeu Date: Thu, 26 Feb 2026 21:44:44 +0100 Subject: [PATCH 24/27] fix: wrap namaka check in derivation for nix build namaka.lib.load returns {} on success, which isn't a derivation. Wrap in runCommand so nix build .#checks. works. --- src/tests/checks.nix | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/tests/checks.nix b/src/tests/checks.nix index cbd91d1e..84f6e7ca 100644 --- a/src/tests/checks.nix +++ b/src/tests/checks.nix @@ -1,16 +1,22 @@ let - inherit (inputs) namaka self; + inherit (inputs) namaka nixpkgs self; inputs' = builtins.removeAttrs inputs ["self"]; + namakaResults = namaka.lib.load { + src = self + /tests; + inputs = + inputs' + // + # inputs.self is too noisy for 'check-augmented-cell-inputs' + {inputs = inputs';}; + }; in { snapshots = { meta.description = "The main Standard Snapshotting test suite"; - check = namaka.lib.load { - src = self + /tests; - inputs = - inputs' - // - # inputs.self is too noisy for 'check-augmented-cell-inputs' - {inputs = inputs';}; - }; + # 2026-03-01 @mayeu: unsure if that's ok, but namaka.lib.load throws on + # failure, returns {} on success. Wrap in a derivation so nix build + # .#checks. works. + check = nixpkgs.runCommand "namaka-snapshots" {} '' + # ${builtins.toJSON namakaResults} + touch $out ''; }; } From 8061a616b76ff1dfa1ffbf00caeeb4b172811ef9 Mon Sep 17 00:00:00 2001 From: Mayeu Date: Sun, 1 Mar 2026 13:39:54 +0100 Subject: [PATCH 25/27] feat: add makefile target to format --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 67845108..d0141dc9 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,10 @@ SYSTEM := $(shell nix eval --impure --raw --expr 'builtins.currentSystem') LINUX := x86_64-linux DARWIN := aarch64-darwin +.PHONY: fmt +fmt: + treefmt + update-sub-flake: cd $(root) cd src/local && nix flake update From 60631e25a0e8b66da5333abf0a9b90ff51e7d5c2 Mon Sep 17 00:00:00 2001 From: Mayeu Date: Sun, 1 Mar 2026 13:45:21 +0100 Subject: [PATCH 26/27] chore: ignore the formatting commit in git blame --- .git-blame-ignore-revs | 1 + 1 file changed, 1 insertion(+) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000..db94bded --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1 @@ +663321ed4f88c1af3127195c6b9a2130c22a11ab From 7a52fe15e249fda783c1d0aa24b29513d3e4e12f Mon Sep 17 00:00:00 2001 From: Mayeu Date: Thu, 12 Mar 2026 21:56:37 +0100 Subject: [PATCH 27/27] fix: don't run the lefthook hook setup if in a git worktree --- src/lib/cfg/lefthook.md | 59 ++++++++++++++++++++++++++++++++++++++++ src/lib/cfg/lefthook.nix | 12 ++++++-- 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/src/lib/cfg/lefthook.md b/src/lib/cfg/lefthook.md index 803582a0..626b42ff 100644 --- a/src/lib/cfg/lefthook.md +++ b/src/lib/cfg/lefthook.md @@ -11,3 +11,62 @@ ```nix {{#include ../../src/lib/cfg/lefthook.nix}} ``` + +#### Explanation of the `in { ... }` block + +This `in { ... }` block is a **Nixago configuration record**, it tells the +Nixago block type how to generate and manage the `lefthook.yml` file. + +`data = {};` is The actual lefthook config content. It's empty here because this +is just the template/scaffold, the real config data gets merged in by consumers +(e.g. in `src/local/configs.nix` or wherever this is used). Nixago deep-merges +`data` from the caller. + +`hook.extra` is a Nixago hook hat runs whenever the generated `lefthook.yml` is +materialized. It receives the final merged `config` (the full lefthook YAML +content as a Nix attrset) and produces extra shell commands. Here's the pipeline +step by step: + +```nix +hook.extra = config: + let + commands = lib.pipe config [ + # 1. Strip non-stage keys (colors, extends, etc.) + # e.g. { pre-commit = {...}; commit-msg = {...}; colors = true; } + # becomes { pre-commit = {...}; commit-msg = {...}; } + toStagesConfig + + # 2. Extract just the attribute names → ["pre-commit" "commit-msg"] + lib.attrNames + + # 3. For each stage, create a symlink command: + # ln -sf "/nix/store/...-lefthook-pre-commit" ".git/hooks/pre-commit" + # The target is a Nix-built script (mkScript) that runs: + # lefthook run "pre-commit" "$@" + # (unless $LEFTHOOK == "0", which disables it) + (lib.map (stage: ''ln -sf "${mkScript stage}" ".git/hooks/${stage}"'')) + + # 4. Prepend "mkdir -p .git/hooks" IF there are any stages + # ["mkdir -p .git/hooks" "ln -sf ..." "ln -sf ..."] + (stages: + lib.optional (stages != []) "mkdir -p .git/hooks" + ++ stages) + + # 5. Join into a single newline-separated shell script string + (lib.concatStringsSep "\n") + ]; + in '' + # Only install hooks in the main repo, not in worktrees. + # In worktrees, .git is a file pointing to the main repo's .git dir, + # so mkdir -p .git/hooks would fail. + if test "$(git rev-parse --git-dir)" = "$(git rev-parse --git-common-dir)"; then + ${commands} + fi + ''; +``` + +When you run the Nixago hook (e.g. via `direnv allow` or `std` commands), it: + +1. Writes `lefthook.yml` to your project root +2. Runs this `hook.extra` script, which symlinks Nix-built wrapper scripts into + `.git/hooks/` (only in the main repo, not in worktrees) diff --git a/src/lib/cfg/lefthook.nix b/src/lib/cfg/lefthook.nix index c34180fd..6b8e9cd8 100644 --- a/src/lib/cfg/lefthook.nix +++ b/src/lib/cfg/lefthook.nix @@ -21,9 +21,10 @@ in { format = "yaml"; output = "lefthook.yml"; packages = [nixpkgs.lefthook]; - # Add an extra hook for adding required stages whenever the file changes - hook.extra = config: - lib.pipe config [ + # Add an extra hook for adding required stages whenever the file changes. + # Skip hook installation in git worktrees where .git is a file, not a directory. + hook.extra = config: let + commands = lib.pipe config [ toStagesConfig lib.attrNames (lib.map (stage: ''ln -sf "${mkScript stage}" ".git/hooks/${stage}"'')) @@ -32,4 +33,9 @@ in { ++ stages) (lib.concatStringsSep "\n") ]; + in '' + if test "$(${lib.getExe nixpkgs.git} rev-parse --git-dir 2>/dev/null)" = "$(${lib.getExe nixpkgs.git} rev-parse --git-common-dir 2>/dev/null)"; then + ${commands} + fi + ''; }