-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathflake.nix
89 lines (76 loc) · 2.24 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
82
83
84
85
86
87
88
89
{
description = "NixOS integration for Vault-backed secrets on systemd services.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.0.1.tar.gz";
};
outputs =
{ nixpkgs
, self
, ...
}@inputs:
let
nameValuePair = name: value: { inherit name value; };
genAttrs = names: f: builtins.listToAttrs (map (n: nameValuePair n (f n)) names);
pkgsFor = pkgs: system:
import pkgs { inherit system; config.allowUnfree = true; };
allSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: genAttrs allSystems
(system: f {
inherit system;
pkgs = pkgsFor nixpkgs system;
});
inherit (nixpkgs) lib;
in
{
nixosModule = self.nixosModules.nixos-vault-service;
nixosModules = {
nixos-vault-service = {
imports = [
./module/implementation.nix
];
nixpkgs.overlays = [
self.overlays.default
];
};
};
packages = forAllSystems
({ pkgs, ... }: rec {
messenger = pkgs.callPackage ./messenger { };
default = messenger;
});
overlays.default = final: prev: {
detsys-messenger = self.packages.${final.stdenv.system}.messenger;
};
devShell = forAllSystems
({ pkgs, ... }:
pkgs.mkShell {
buildInputs = with pkgs; [
(terraform_1.withPlugins (tf: [
tf.local
tf.vault
]))
foreman
jq
vault
nixpkgs-fmt
cargo
] ++ lib.optionals (pkgs.stdenv.isDarwin) (with pkgs; [
libiconv
]);
}
);
checks.definition = import ./module/definition.tests.nix {
inherit nixpkgs;
inherit (nixpkgs) lib;
};
checks.helpers = import ./module/helpers.tests.nix {
inherit nixpkgs;
inherit (nixpkgs) lib;
};
checks.implementation = import ./module/implementation.tests.nix {
inherit nixpkgs self;
inherit (nixpkgs) lib;
};
};
}