forked from NixOS/nixpkgs-vet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.nix
47 lines (45 loc) · 877 Bytes
/
package.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
lib,
rustPlatform,
nix,
rustfmt,
clippy,
makeWrapper,
nixpkgsLibPath,
initNix,
runtimeExprPath,
testNixpkgsPath,
}:
let
fs = lib.fileset;
in
rustPlatform.buildRustPackage {
name = "nixpkgs-check-by-name";
src = fs.toSource {
root = ./.;
fileset = fs.unions [
./Cargo.lock
./Cargo.toml
./src
./tests
];
};
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = [
nix
rustfmt
clippy
makeWrapper
];
env.NIX_CHECK_BY_NAME_EXPR_PATH = "${runtimeExprPath}";
env.NIX_PATH = "test-nixpkgs=${testNixpkgsPath}:test-nixpkgs/lib=${nixpkgsLibPath}";
preCheck = initNix;
postCheck = ''
cargo fmt --check
cargo clippy -- -D warnings
'';
postInstall = ''
wrapProgram $out/bin/nixpkgs-check-by-name \
--set NIX_CHECK_BY_NAME_EXPR_PATH "$NIX_CHECK_BY_NAME_EXPR_PATH"
'';
}