deadnix/flake.nix
Yvan Sraka dd2d313fde Add libiconv (needed by macOS devshell) to flake.nix
Otherwise it fails with:
```
error: linking with `cc` failed: exit status: 1
  | ...

= note: ld: library not found for -liconv
          clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
```
2023-09-21 00:49:02 +02:00

65 lines
1.9 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 \
-A clippy::must-use-candidate \
-A clippy::missing-panics-doc || 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 libiconv ];
RUST_SRC_PATH = rustPlatform.rustLibSrc;
};
})
// {
overlays.default = (_: prev: {
deadnix = deadnixLambda prev;
});
};
}