Skip to content

Commit 42c1f81

Browse files
committed
refactor(flake): Use pr for clippy fixes
1 parent d0fdebb commit 42c1f81

File tree

2 files changed

+58
-32
lines changed

2 files changed

+58
-32
lines changed

flake.lock

Lines changed: 45 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
inputs = {
1616
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
1717
flake-parts = { url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; };
18-
devenv.url = "github:cachix/devenv";
18+
# TODO - Use upstream once https://github.com/cachix/git-hooks.nix/pull/396 is merged
19+
git-hooks = { url = "github:mrcjkb/git-hooks.nix/clippy"; inputs.nixpkgs.follows = "nixpkgs"; };
20+
devenv = { url = "github:cachix/devenv"; inputs.git-hooks.follows = "git-hooks"; };
1921
fenix = { url = "github:nix-community/fenix"; inputs.nixpkgs.follows = "nixpkgs"; };
2022
crane = { url = "github:ipetkov/crane"; };
2123
nci = { url = "github:yusdacra/nix-cargo-integration"; inputs = { nixpkgs.follows = "nixpkgs"; parts.follows = "flake-parts"; crane.follows = "crane"; }; };
@@ -124,6 +126,10 @@
124126
cargo = rustToolchain;
125127
clippy = rustToolchain;
126128
};
129+
extraPackages = [
130+
pkgs.openssl
131+
pkgs.pkg-config
132+
];
127133
};
128134

129135
rustfmt = {
@@ -134,6 +140,11 @@
134140
};
135141
};
136142
};
143+
144+
settings.rust.check.cargoDeps = pkgs.rustPlatform.importCargoLock {
145+
lockFile = ./Cargo.lock;
146+
allowBuiltinFetchGit = true;
147+
};
137148
};
138149
};
139150

@@ -225,22 +236,7 @@
225236
})))
226237
]);
227238

228-
# TODO - Refactor once https://github.com/cachix/git-hooks.nix/pull/396 is merged
229-
checks.pre-commit =
230-
let
231-
inherit (config.devenv.shells.default) git-hooks;
232-
in
233-
pkgs.stdenv.mkDerivation {
234-
name = "pre-commit-run";
235-
src = git-hooks.rootSrc;
236-
buildInputs = [ pkgs.git pkgs.openssl pkgs.pkg-config ];
237-
nativeBuildInputs = [ pkgs.rustPlatform.cargoSetupHook ];
238-
cargoDeps = pkgs.rustPlatform.importCargoLock {
239-
lockFile = ./Cargo.lock;
240-
allowBuiltinFetchGit = true;
241-
};
242-
buildPhase = git-hooks.run.buildCommand;
243-
};
239+
checks.pre-commit = config.devenv.shells.default.git-hooks.run;
244240
};
245241
};
246242
}

0 commit comments

Comments
 (0)