mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-30 09:33:41 +00:00
9efc0c0991
This uses a mutex to make sure that functions that read environment don't read incorrect values.
43 lines
1.0 KiB
Nix
43 lines
1.0 KiB
Nix
{
|
|
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
|
|
|
|
# Ensure that even if tests run in parallel, we don't get an error
|
|
# We'd 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
|