-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
81 lines (76 loc) · 2.17 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
72
73
74
75
76
77
78
79
80
81
{
description = "faythe";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
crane.url = "github:ipetkov/crane";
crane.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, crane, nixpkgs }:
let
pname = "faythe";
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [ crane-overlay self.overlays.default ];
config = {
allowUnfreePredicate = pkg:
builtins.elem (builtins.parseDrvName (pkg.name or pkg.pname)).name [
"vault"
];
};
};
crane-overlay = final: prev: {
# crane's lib is not exposed as an overlay in its flake (should be added
# upstream ideally) so this interface might be brittle, but avoids
# accidentally passing a detached nixpkgs from its flake (or its follows)
# on to consumers.
craneLib = crane.mkLib final;
};
in {
packages.${system}.${pname} = pkgs.${pname};
defaultPackage.${system} = pkgs.${pname};
overlays.default = final: prev: {
"${pname}" = final.craneLib.buildPackage {
src =
let
srcPath = ./.;
in
with final; lib.cleanSourceWith {
src = srcPath;
filter = path: type:
craneLib.filterCargoSources path type ||
lib.hasPrefix "${toString srcPath}/test" path;
};
nativeBuildInputs = with final; [
pkg-config
];
buildInputs = with final; [
openssl
];
};
};
checks.${system} = {
sample-configs = pkgs.runCommandNoCC "check-sample-configs" { nativeBuildInputs = [ pkgs.${pname} ]; } ''
DIR=${./config-samples}
for FILE in $(ls -1 $DIR); do
echo "Testing: $DIR/$FILE"
faythe $DIR/$FILE --config-check >>$out
done
'';
vault = pkgs.callPackage ./nixos/vault-test.nix {};
};
devShell.${system} = with pkgs; mkShell {
buildInputs = [
rust-analyzer
cargo
crate2nix
openssl.dev
pkg-config
rustc
zlib.dev
dnsutils # runtime
kubectl # runtime
];
};
};
}