-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
116 lines (96 loc) · 2.51 KB
/
Copy pathflake.nix
File metadata and controls
116 lines (96 loc) · 2.51 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
{
description = "vk";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane.url = "github:ipetkov/crane";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
crane,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
craneLib = crane.mkLib pkgs;
src = craneLib.cleanCargoSource ./.;
commonArgs = {
inherit src;
strictDeps = true;
OPENSSL_NO_VENDOR = "1";
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
nativeBuildInputs = [
pkgs.pkg-config
];
buildInputs = [
pkgs.openssl
]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.libiconv
];
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
vk = craneLib.buildPackage (
commonArgs
// {
inherit cargoArtifacts;
}
);
in
{
checks = {
inherit vk;
vk-clippy = craneLib.cargoClippy (
commonArgs
// {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
}
);
vk-doc = craneLib.cargoDoc (
commonArgs
// {
inherit cargoArtifacts;
env.RUSTDOCFLAGS = "--deny warnings";
}
);
vk-fmt = craneLib.cargoFmt {
inherit src;
};
};
packages = {
default = vk;
};
apps.default = flake-utils.lib.mkApp {
drv = vk;
};
devShells.default = craneLib.devShell {
checks = self.checks.${system};
packages = [
];
};
}
)
// {
# System-agnostic, so it lives outside eachDefaultSystem — moira reads it
# as `.#moiraFlake`.
#
# `checks.*` is the point here: vk-fmt, vk-clippy, vk-doc and vk are
# already crane derivations covering exactly what `.moira/test.yaml` runs
# by hand, and until now nothing built them. As jobs they are hermetic,
# pushed to the org cache, and skipped entirely on a commit that did not
# change their inputs.
moiraFlake = {
include = [
"packages.*"
"checks.*"
];
};
};
}