blob: cb8a672bc990cce2219e6ed44d1198e49e6e96d2 (
plain) (
blame)
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
|
{
lib,
rustPlatform,
nix,
rustfmt,
clippy,
mkShell,
}:
let
package =
rustPlatform.buildRustPackage {
name = "nixpkgs-check-by-name";
src = lib.cleanSource ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = [
nix
rustfmt
clippy
];
# Needed to make Nix evaluation work inside the nix build
preCheck = ''
export TEST_ROOT=$(pwd)/test-tmp
export NIX_CONF_DIR=$TEST_ROOT/etc
export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
export NIX_STATE_DIR=$TEST_ROOT/var/nix
export NIX_STORE_DIR=$TEST_ROOT/store
# cargo tests run in parallel by default, which would then run into
# https://github.com/NixOS/nix/issues/2706 unless the store is initialised first
nix-store --init
'';
postCheck = ''
cargo fmt --check
cargo clippy -- -D warnings
'';
passthru.shell = mkShell {
inputsFrom = [ package ];
};
};
in
package
|