diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2e1b37..4b343a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,18 +27,17 @@ jobs: timeout-minutes: 10 permissions: contents: read + defaults: + run: + shell: nix develop --command bash -eo pipefail {0} steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - - name: Install Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0 - with: - toolchain: stable - components: clippy - rustflags: "" + - name: Set up Nix + uses: furedea/reusable-workflows/.github/actions/nix-setup@2ae953294b9a805d0705657adc1d9d4f1bc1f646 # v1.3.0 - name: Run clippy run: cargo clippy -- -D warnings @@ -48,18 +47,17 @@ jobs: timeout-minutes: 10 permissions: contents: read + defaults: + run: + shell: nix develop --command bash -eo pipefail {0} steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - - name: Install Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0 - with: - toolchain: stable - components: rustfmt - rustflags: "" + - name: Set up Nix + uses: furedea/reusable-workflows/.github/actions/nix-setup@2ae953294b9a805d0705657adc1d9d4f1bc1f646 # v1.3.0 - name: Run rustfmt run: cargo fmt --check @@ -69,17 +67,17 @@ jobs: timeout-minutes: 10 permissions: contents: read + defaults: + run: + shell: nix develop --command bash -eo pipefail {0} steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - - name: Install Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0 - with: - toolchain: stable - rustflags: "" + - name: Set up Nix + uses: furedea/reusable-workflows/.github/actions/nix-setup@2ae953294b9a805d0705657adc1d9d4f1bc1f646 # v1.3.0 - name: Run tests run: cargo test @@ -89,17 +87,23 @@ jobs: timeout-minutes: 10 permissions: contents: read + defaults: + run: + shell: nix develop --command bash -eo pipefail {0} steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false + - name: Set up Nix + uses: furedea/reusable-workflows/.github/actions/nix-setup@2ae953294b9a805d0705657adc1d9d4f1bc1f646 # v1.3.0 + - name: Run cargo-deny - uses: EmbarkStudios/cargo-deny-action@6c8f9facfa5047ec02d8485b6bf52b587b7777d1 # v2.0.18 + run: cargo deny check - name: Run cargo-machete - uses: bnjbvr/cargo-machete@ac30a525c0a8d163a92d727b3ff079ee3f6ecb08 # v0.9.2 + run: cargo machete gha-lint: uses: furedea/reusable-workflows/.github/workflows/gha-lint.yml@ca7c5f2973a899e209bc60767f434aecbc186bc9 # v1.1.0 diff --git a/flake.nix b/flake.nix index 58caf1b..73ec927 100644 --- a/flake.nix +++ b/flake.nix @@ -9,26 +9,37 @@ outputs = { nixpkgs, nixpkgs-unstable, ... }: let - system = "aarch64-darwin"; - pkgs = import nixpkgs { inherit system; }; + systems = [ + "aarch64-darwin" + "x86_64-linux" + ]; + forAllSystems = nixpkgs.lib.genAttrs systems; in { - devShells.${system}.default = pkgs.mkShell { - packages = with pkgs; [ - cargo - cargo-deny - cargo-machete - clippy - commitlint - deadnix - # lefthook before 2.1.6 runs hooks under a pty, which agent sandboxes deny. - nixpkgs-unstable.legacyPackages.${system}.lefthook - ls-lint - nixfmt - rustc - rustfmt - statix - ]; - }; + devShells = forAllSystems ( + system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + default = pkgs.mkShell { + packages = with pkgs; [ + cargo + cargo-deny + cargo-machete + clippy + commitlint + deadnix + # lefthook before 2.1.6 runs hooks under a pty, which agent sandboxes deny. + nixpkgs-unstable.legacyPackages.${system}.lefthook + ls-lint + nixfmt + rustc + rustfmt + statix + ]; + }; + } + ); }; }