noogle/pesto/flake-module.nix

45 lines
1.2 KiB
Nix
Raw Normal View History

{ inputs, ... }: {
perSystem = { self', inputs', pkgs, system, ... }:
let
craneLib = inputs.crane.lib.${system};
src = craneLib.cleanCargoSource (craneLib.path ./.);
commonArgs = {
inherit src;
strictDeps = true;
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
};
pesto = craneLib.buildPackage commonArgs;
2023-12-22 22:34:22 +03:00
data-json = pkgs.stdenv.mkDerivation {
name = "pesto-data";
src = ./.;
2023-12-22 22:34:22 +03:00
buildPhase = ''
${pesto}/bin/pesto --pos-file ${self'.packages.pasta} --format json $out
'';
};
checks = {
inherit pesto;
2023-11-25 19:30:43 +03:00
pesto-clippy = craneLib.cargoClippy (commonArgs // {
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
});
2023-11-25 19:30:43 +03:00
pesto-fmt = craneLib.cargoFmt { inherit src; };
pesto-nextest = craneLib.cargoNextest (commonArgs // {
partitions = 1;
partitionType = "count";
});
};
2023-11-28 19:28:51 +03:00
in
{
2023-12-22 22:34:22 +03:00
packages = { inherit pesto data-json; };
inherit checks;
devShells.pesto = craneLib.devShell {
# Inherit inputs from checks.
inherit checks;
};
};
}