From a6f5c96b2d9449c26270a2fa007ae730dc4d3bae Mon Sep 17 00:00:00 2001 From: furedea <132188853+furedea@users.noreply.github.com> Date: Mon, 9 Nov 2026 21:39:56 +0900 Subject: [PATCH 1/3] feat(nix): provide the dev shell for x86_64-linux CI will run the Go tools from this dev shell on Linux runners. Refs furedea/reusable-workflows#23 Co-Authored-By: Claude Sonnet 5.5 --- flake.nix | 49 ++++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/flake.nix b/flake.nix index 1305605..f9718c8 100644 --- a/flake.nix +++ b/flake.nix @@ -9,26 +9,37 @@ outputs = { nixpkgs, nixpkgs-unstable, ... }: let - system = "aarch64-darwin"; - pkgs = import nixpkgs { inherit system; }; - unstable = nixpkgs-unstable.legacyPackages.${system}; + systems = [ + "aarch64-darwin" + "x86_64-linux" + ]; + forAllSystems = nixpkgs.lib.genAttrs systems; in { - devShells.${system}.default = pkgs.mkShell { - env.GOTOOLCHAIN = "local"; - packages = with pkgs; [ - commitlint - deadnix - go_1_27 - gopls - # lefthook before 2.1.6 runs hooks under a pty, which agent sandboxes deny. - unstable.lefthook - # golangci-lint refuses modules newer than the Go that built it. - unstable.golangci-lint - ls-lint - nixfmt - statix - ]; - }; + devShells = forAllSystems ( + system: + let + pkgs = import nixpkgs { inherit system; }; + unstable = nixpkgs-unstable.legacyPackages.${system}; + in + { + default = pkgs.mkShell { + env.GOTOOLCHAIN = "local"; + packages = with pkgs; [ + commitlint + deadnix + go_1_27 + gopls + # lefthook before 2.1.6 runs hooks under a pty, which agent sandboxes deny. + unstable.lefthook + # golangci-lint refuses modules newer than the Go that built it. + unstable.golangci-lint + ls-lint + nixfmt + statix + ]; + }; + } + ); }; } From c2271ea91b5a1b928a3b5dde7f9c83c3a47c969b Mon Sep 17 00:00:00 2001 From: furedea <132188853+furedea@users.noreply.github.com> Date: Mon, 9 Nov 2026 21:52:33 +0900 Subject: [PATCH 2/3] ci: run Go tools from the flake dev shell Replace setup-go and golangci-lint-action with the nix-setup composite action and run every step in nix develop. Refs: furedea/reusable-workflows#23 Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/ci.yml | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11c5405..d71bdc9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ concurrency: defaults: run: - shell: bash + shell: nix develop --command bash -eo pipefail {0} jobs: nix-lint: @@ -33,15 +33,11 @@ jobs: with: persist-credentials: false - - name: Set up Go - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 - with: - go-version-file: go.mod + - name: Set up Nix + uses: furedea/reusable-workflows/.github/actions/nix-setup@2ae953294b9a805d0705657adc1d9d4f1bc1f646 # v1.3.0 - name: Run golangci-lint - uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0 - with: - version: v2.15.0 + run: golangci-lint run format: runs-on: ubuntu-latest @@ -54,16 +50,8 @@ jobs: with: persist-credentials: false - - name: Set up Go - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 - with: - go-version-file: go.mod - - - name: Install golangci-lint - uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0 - with: - version: v2.15.0 - install-only: true + - name: Set up Nix + uses: furedea/reusable-workflows/.github/actions/nix-setup@2ae953294b9a805d0705657adc1d9d4f1bc1f646 # v1.3.0 - name: Run golangci-lint fmt run: golangci-lint fmt --diff @@ -79,10 +67,8 @@ jobs: with: persist-credentials: false - - name: Set up Go - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 - with: - go-version-file: go.mod + - name: Set up Nix + uses: furedea/reusable-workflows/.github/actions/nix-setup@2ae953294b9a805d0705657adc1d9d4f1bc1f646 # v1.3.0 - name: Run tests run: go test -race -cover ./... @@ -98,10 +84,8 @@ jobs: with: persist-credentials: false - - name: Set up Go - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 - with: - go-version-file: go.mod + - name: Set up Nix + uses: furedea/reusable-workflows/.github/actions/nix-setup@2ae953294b9a805d0705657adc1d9d4f1bc1f646 # v1.3.0 - name: Run govulncheck run: go tool govulncheck ./... From c05ff54b7abd034dd8cf82da074a5a9a90c8a066 Mon Sep 17 00:00:00 2001 From: furedea <132188853+furedea@users.noreply.github.com> Date: Mon, 9 Nov 2026 21:59:30 +0900 Subject: [PATCH 3/3] ci: keep all-green on plain bash The workflow default shell needs Nix, which all-green does not install, so a failure there would print nix: command not found. Refs: furedea/reusable-workflows#23 Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d71bdc9..1a997be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -145,6 +145,9 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 1 permissions: {} + defaults: + run: + shell: bash steps: - name: Fail if any prerequisite did not succeed if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')