flake: clean up crane and rust-overlay usage

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
Christoph Heiss 2024-08-16 16:24:19 +02:00
parent a175fca2dd
commit b3c92de737
Signed by: c8h4
GPG key ID: 1538094429952F86

View file

@ -51,21 +51,22 @@
commonArgs = {
inherit src;
cargoVendorDir = null;
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
strictDeps = true;
commonArgsWithArtifacts = commonArgs // { inherit cargoArtifacts; };
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [ openssl ];
};
cargoTypos = args:
craneLib.mkCargoDerivation (commonArgs // args // {
craneLib.mkCargoDerivation (args // {
cargoArtifacts = null;
cargoVendorDir = null;
buildPhaseCargoCommand = "typos";
pnameSuffix = "-typos";
nativeBuildInputs = (args.nativeBuildInputs or [ ])
++ (with pkgs; [ typos protobuf ]);
++ (with pkgs; [ typos cargo-machete ]);
preInstallPhases = [ "ensureTargetDir" ]
++ (args.preInstallPhases or [ ]);
@ -77,15 +78,19 @@
shouldRunCoverage = system == "x86_64-linux"
&& ((builtins.getEnv "CI") != "");
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
commonArgsWithArtifacts = commonArgs // { inherit cargoArtifacts; };
bwtui = craneLib.buildPackage commonArgsWithArtifacts;
in {
checks = {
inherit bwtui;
default = bwtui;
formatting = treefmt.config.build.check self;
bwtui-clippy = craneLib.cargoClippy commonArgsWithArtifacts // {
bwtui-clippy = craneLib.cargoClippy (commonArgsWithArtifacts // {
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
};
});
bwtui-doc = craneLib.cargoDoc commonArgsWithArtifacts;
bwtui-fmt = craneLib.cargoFmt commonArgs;
bwtui-typos = cargoTypos commonArgs;