mirror of
https://github.com/astro/deadnix.git
synced 2024-12-01 00:22:07 +03:00
63 lines
1.8 KiB
Nix
63 lines
1.8 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
utils.url = "github:numtide/flake-utils";
|
|
naersk = {
|
|
url = "github:nix-community/naersk/master";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs = { self, nixpkgs, utils, naersk }:
|
|
let
|
|
inherit (nixpkgs) lib;
|
|
deadnixLambda = pkgs:
|
|
let
|
|
naersk-lib = pkgs.callPackage naersk { };
|
|
in
|
|
naersk-lib.buildPackage {
|
|
pname = "deadnix";
|
|
root = ./.;
|
|
checkInputs = [ pkgs.rustPackages.clippy ];
|
|
doCheck = true;
|
|
cargoTestCommands = x:
|
|
x ++ [
|
|
''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 || true''
|
|
];
|
|
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 ];
|
|
RUST_SRC_PATH = rustPlatform.rustLibSrc;
|
|
};
|
|
})
|
|
// {
|
|
overlays.default = (_: prev: {
|
|
deadnix = deadnixLambda prev;
|
|
});
|
|
};
|
|
}
|