diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml new file mode 100644 index 0000000000..a42ca093ae --- /dev/null +++ b/.github/workflows/nix.yml @@ -0,0 +1,22 @@ +name: Test Nix flake + +on: + pull_request: + push: + branches: + - main + +jobs: + format: + name: check flake formatting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + show-progress: false + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - run: nix fmt + + # Check that formatting does not change anything. + - run: git diff --exit-code diff --git a/flake.nix b/flake.nix index 5a21605988..bd532030b8 100644 --- a/flake.nix +++ b/flake.nix @@ -533,28 +533,30 @@ }; }; - devShells.default = let - pkgs = import nixpkgs { - system = system; - overlays = [ fenix.overlays.default ]; - }; - in pkgs.mkShell { + devShells.default = + let + pkgs = import nixpkgs { + system = system; + overlays = [ fenix.overlays.default ]; + }; + in + pkgs.mkShell { - buildInputs = with pkgs; [ - (fenix.packages.${system}.complete.withComponents [ - "cargo" - "clippy" - "rust-src" - "rustc" - "rustfmt" - ]) - cargo-deny - rust-analyzer-nightly - cargo-nextest - perl # needed to build vendored OpenSSL - git-cliff - ]; - }; + buildInputs = with pkgs; [ + (fenix.packages.${system}.complete.withComponents [ + "cargo" + "clippy" + "rust-src" + "rustc" + "rustfmt" + ]) + cargo-deny + rust-analyzer-nightly + cargo-nextest + perl # needed to build vendored OpenSSL + git-cliff + ]; + }; } ); }