From e117efa74495867b07400924dc42dade9cb84381 Mon Sep 17 00:00:00 2001 From: link2xt Date: Thu, 14 Nov 2024 16:22:13 +0000 Subject: [PATCH] ci: ensure flake is formatted --- .github/workflows/nix.yml | 22 ++++++++++++++++++++ flake.nix | 44 ++++++++++++++++++++------------------- 2 files changed, 45 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/nix.yml 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 + ]; + }; } ); }