diff options
Diffstat (limited to 'nixpkgs/pkgs/test/nixpkgs-check-by-name/default.nix')
-rw-r--r-- | nixpkgs/pkgs/test/nixpkgs-check-by-name/default.nix | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/test/nixpkgs-check-by-name/default.nix b/nixpkgs/pkgs/test/nixpkgs-check-by-name/default.nix new file mode 100644 index 000000000000..a997fc8612c8 --- /dev/null +++ b/nixpkgs/pkgs/test/nixpkgs-check-by-name/default.nix @@ -0,0 +1,38 @@ +{ + 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 + ''; + postCheck = '' + cargo fmt --check + cargo clippy -- -D warnings + ''; + passthru.shell = mkShell { + inputsFrom = [ package ]; + }; + }; +in +package |