adnix-rs/flake.nix

105 lines
2.7 KiB
Nix

{
description = "adnix";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.systems.url = "github:msfjarvis/flake-systems";
inputs.advisory-db.url = "github:rustsec/advisory-db";
inputs.advisory-db.flake = false;
inputs.crane.url = "github:ipetkov/crane";
inputs.crane.inputs.nixpkgs.follows = "nixpkgs";
inputs.devshell.url = "github:numtide/devshell";
inputs.devshell.inputs.nixpkgs.follows = "nixpkgs";
inputs.devshell.inputs.flake-utils.follows = "flake-utils";
inputs.fenix.url = "github:nix-community/fenix";
inputs.fenix.inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.flake-utils.inputs.systems.follows = "systems";
inputs.flake-compat.url = "github:nix-community/flake-compat";
inputs.flake-compat.flake = false;
outputs = {
self,
nixpkgs,
advisory-db,
crane,
devshell,
fenix,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [devshell.overlays.default];
};
rustStable = (import fenix {inherit pkgs;}).fromToolchainFile {
file = ./rust-toolchain.toml;
sha256 = "sha256-7QfkHty6hSrgNM0fspycYkRcB82eEqYa4CoAJ9qA3tU=";
};
craneLib = (crane.mkLib pkgs).overrideToolchain rustStable;
commonArgs = {
src = craneLib.cleanCargoSource ./.;
buildInputs = [];
nativeBuildInputs = [];
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
};
cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {doCheck = false;});
adnix = craneLib.buildPackage (commonArgs
// {
doCheck = false;
});
adnix-clippy = craneLib.cargoClippy (commonArgs
// {
inherit cargoArtifacts;
});
adnix-fmt = craneLib.cargoFmt (commonArgs // {});
adnix-audit = craneLib.cargoAudit (commonArgs // {inherit advisory-db;});
adnix-nextest = craneLib.cargoNextest (commonArgs
// {
inherit cargoArtifacts;
src = ./.;
partitions = 1;
partitionType = "count";
});
in {
checks = {
inherit adnix adnix-audit adnix-clippy adnix-fmt adnix-nextest;
};
packages.default = adnix;
apps.default = flake-utils.lib.mkApp {drv = adnix;};
devShells.default = pkgs.devshell.mkShell {
bash = {interactive = "";};
env = [
{
name = "DEVSHELL_NO_MOTD";
value = 1;
}
];
packages = with pkgs; [
cargo-dist
cargo-nextest
cargo-release
oranda
rustStable
stdenv.cc
];
};
});
}