Skip to content

Commit ada16ec

Browse files
committed
nix: improve checks
1 parent 7ede210 commit ada16ec

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

.github/workflows/check.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
uses: DeterminateSystems/magic-nix-cache-action@main
2828

2929
- name: Check
30-
run: nix build --fallback --print-build-logs '.#check-clippy'
30+
run: nix build --fallback --print-build-logs ".#checks.$(nix eval --impure --raw --expr "builtins.currentSystem").clippy"
3131

3232
- name: Upload analysis results
3333
uses: github/codeql-action/upload-sarif@v3
@@ -49,7 +49,7 @@ jobs:
4949
uses: DeterminateSystems/magic-nix-cache-action@main
5050

5151
- name: Check
52-
run: nix build --fallback --print-build-logs '.#check-rustfmt'
52+
run: nix build --fallback --print-build-logs ".#checks.$(nix eval --impure --raw --expr "builtins.currentSystem").rustfmt"
5353

5454
nixfmt:
5555
runs-on: ubuntu-latest
@@ -65,7 +65,7 @@ jobs:
6565
uses: DeterminateSystems/magic-nix-cache-action@main
6666

6767
- name: Check
68-
run: nix build --fallback --print-build-logs '.#check-nixfmt'
68+
run: nix build --fallback --print-build-logs ".#checks.$(nix eval --impure --raw --expr "builtins.currentSystem").nixfmt"
6969

7070
reuse:
7171
runs-on: ubuntu-latest
@@ -81,4 +81,4 @@ jobs:
8181
uses: DeterminateSystems/magic-nix-cache-action@main
8282

8383
- name: Check
84-
run: nix build --fallback --print-build-logs '.#check-reuse'
84+
run: nix build --fallback --print-build-logs ".#checks.$(nix eval --impure --raw --expr "builtins.currentSystem").reuse"

flake.nix

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@
4444
pkgs.stdenv.mkDerivation (
4545
{
4646
name = "check-${name}";
47-
47+
inherit (self.packages.${system}.nyoom) src;
4848
inherit nativeBuildInputs;
49-
inherit (self.packages.${system}.nyoom) src cargoDeps;
49+
50+
strictDeps = true;
5051

5152
buildPhase = ''
5253
${command}
@@ -81,20 +82,29 @@
8182
clippy = mkFlakeCheck {
8283
name = "clippy";
8384

84-
nativeBuildInputs = with pkgs; [
85-
rustPlatform.cargoSetupHook
86-
cargo
87-
rustc
88-
clippy
89-
clippy-sarif
90-
sarif-fmt
91-
];
85+
nativeBuildInputs =
86+
with pkgs;
87+
[
88+
rustPlatform.cargoSetupHook
89+
cargo
90+
rustc
91+
clippy
92+
clippy-sarif
93+
sarif-fmt
94+
]
95+
++ lib.optionals stdenv.hostPlatform.isDarwin [
96+
pkg-config
97+
];
9298

9399
command = ''
94100
cargo clippy --all-features --all-targets --tests \
95101
--offline --message-format=json \
96102
| clippy-sarif | tee $out | sarif-fmt
97103
'';
104+
105+
extraConfig = {
106+
inherit (self.packages.${system}.nyoom) cargoDeps buildInputs;
107+
};
98108
};
99109

100110
reuse = mkFlakeCheck {
@@ -153,9 +163,6 @@
153163
inherit (packages) nyoom;
154164
default = packages.nyoom;
155165
}
156-
// (lib.attrsets.mapAttrs' (
157-
name: value: lib.nameValuePair "check-${name}" value
158-
) self.checks.${system})
159166
);
160167

161168
legacyPackages = forAllSystems (

nix/package.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ rustPlatform.buildRustPackage rec {
3939
lockFile = ../Cargo.lock;
4040
};
4141

42-
buildInputs = lib.optionals stdenv.isDarwin [
42+
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
4343
darwin.apple_sdk.frameworks.CoreFoundation
4444
darwin.apple_sdk.frameworks.Security
4545
darwin.apple_sdk.frameworks.SystemConfiguration
@@ -51,7 +51,7 @@ rustPlatform.buildRustPackage rec {
5151
[
5252
installShellFiles
5353
]
54-
++ lib.optionals stdenv.isDarwin [
54+
++ lib.optionals stdenv.hostPlatform.isDarwin [
5555
pkg-config
5656
];
5757

0 commit comments

Comments
 (0)