{
inputs = {
naersk.url = "github:nix-community/naersk/master";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
crane.url = "github:ipetkov/crane";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs@{
nixpkgs,
flake-parts,
treefmt-nix,
crane,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } (
{ self, ... }@args:
{
imports = [
treefmt-nix.flakeModule
];
systems = nixpkgs.lib.systems.flakeExposed;
perSystem =
{ pkgs, ... }:
let
craneLib = crane.mkLib pkgs;
commonArgs = {
src = craneLib.cleanCargoSource ./.;
strictDeps = true;
buildInputs = with pkgs; [
notmuch
graphviz
];
};
crate = craneLib.buildPackage (
commonArgs // { cargoArtifacts = craneLib.buildDepsOnly commonArgs; }
);
in
{
checks = {
inherit crate;
};
packages = rec {
default = notmuch-tagrewriter;
notmuch-tagrewriter = crate;
};
devShells.default = craneLib.devShell {
packages = with pkgs; [
rustfmt
pre-commit
rustPackages.clippy
notmuch
graphviz
];
};
};
}
);
}