-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
61 lines (57 loc) · 1.47 KB
/
default.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
{ pkg-config
, openssl
, stdenv
, callPackage
, texlive
, makeWrapper
, nix-gitignore
, buildFeatures ? []
, craneLib
, system
, lib
, darwin
}:
let
tex = import ./latex { inherit texlive; };
src = nix-gitignore.gitignoreSource [] ./.;
nativeBuildInputs = [
openssl
pkg-config
];
# Build *just* the cargo dependencies, so we can reuse
# all of that work (e.g. via cachix) when running in CI
cargoArtifacts = craneLib.buildDepsOnly {
inherit src nativeBuildInputs;
};
# Run clippy (and deny all warnings) on the crate source,
# resuing the dependency artifacts (e.g. from build scripts or
# proc-macros) from above.
#
# Note that this is done as a separate derivation so it
# does not impact building just the crate by itself.
orca-clippy = craneLib.cargoClippy {
inherit cargoArtifacts src nativeBuildInputs;
cargoClippyExtraArgs = "-- --deny warnings";
};
orca-fmt = craneLib.cargoFmt {
inherit src;
};
in
rec {
orca = craneLib.buildPackage {
inherit cargoArtifacts src;
cargoExtraArgs =
if buildFeatures == []
then ""
else ''--features "${lib.strings.concatStringsSep " " buildFeatures}"'';
nativeBuildInputs = nativeBuildInputs ++ [ makeWrapper ];
buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
];
postInstall = ''
wrapProgram "$out/bin/orca" --suffix PATH : "${tex}/bin"
'';
};
inherit orca-clippy;
inherit orca-fmt;
}