-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathflake.nix
71 lines (60 loc) · 1.76 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
crane = {
url = "https://flakehub.com/f/ipetkov/crane/0.18.*.tar.gz";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs =
{
self,
crane,
flake-utils,
nixpkgs,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = (import nixpkgs) { inherit system; };
inherit (pkgs) lib;
craneLib = crane.mkLib pkgs;
src = craneLib.cleanCargoSource ./.;
commonArgs = craneLib.crateNameFromCargoToml { cargoToml = ./lcat/Cargo.toml; } // {
inherit src;
strictDeps = true;
buildInputs = lib.optionals pkgs.stdenv.isDarwin (
with pkgs;
[
iconv
darwin.apple_sdk.frameworks.Security
]
);
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
lcat = craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; });
in
{
formatter = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style;
checks = {
inherit lcat;
lcat-clippy = craneLib.cargoClippy (
commonArgs
// {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
}
);
lcat-fmt = craneLib.cargoFmt commonArgs;
lcat-deny = craneLib.cargoDeny commonArgs;
};
packages.default = lcat;
apps.default = flake-utils.lib.mkApp { drv = lcat; };
devShells.default = craneLib.devShell {
# Inherit inputs from checks.
checks = self.checks.${system};
};
}
);
}