-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
flake.nix
58 lines (55 loc) · 1.75 KB
/
flake.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
48
49
50
51
52
53
54
55
56
57
58
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils }:
let
inherit (nixpkgs) lib;
deadnixLambda = pkgs:
pkgs.rustPlatform.buildRustPackage {
pname = "deadnix";
version = self.sourceInfo.lastModifiedDate;
src = self;
cargoLock.lockFile = ./Cargo.lock;
nativeCheckInputs = [ pkgs.clippy ];
doCheck = true;
postCheck = ''
cargo clippy --all --all-features --tests -- \
-D clippy::pedantic \
-D warnings \
-A clippy::module-name-repetitions \
-A clippy::too-many-lines \
-A clippy::cast-possible-wrap \
-A clippy::cast-possible-truncation \
-A clippy::nonminimal_bool \
-A clippy::must-use-candidate \
-A clippy::missing-panics-doc
'';
meta.description = "Scan Nix files for dead code";
};
in
utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages = {
default = self.packages."${system}".deadnix;
deadnix = deadnixLambda pkgs;
};
apps.default = utils.lib.mkApp {
drv = self.packages."${system}".default;
};
devShells.default = with pkgs; mkShell {
nativeBuildInputs = [ cargo rustc rustfmt rustPackages.clippy rust-analyzer libiconv ];
RUST_SRC_PATH = rustPlatform.rustLibSrc;
};
})
// {
overlays.default = (final: _: {
deadnix = deadnixLambda final;
});
};
}