-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathflake.nix
179 lines (159 loc) · 5.05 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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
{
description = "Flake containing Bitte clusters";
inputs.std.url = "github:divnix/std";
inputs.flake-arch.url = "github:johnalotoski/flake-arch";
inputs.n2c.url = "github:nlewo/nix2container";
inputs.data-merge.url = "github:divnix/data-merge";
inputs.capsules.url = "github:input-output-hk/devshell-capsules";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
nixpkgs-docker.url = "github:nixos/nixpkgs/ff691ed9ba21528c1b4e034f36a04027e4522c58";
nixpkgs-terraform.url = "github:NixOS/nixpkgs/8b3398bc7587ebb79f93dfeea1b8c574d3c6dba1";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nix.url = "github:nixos/nix/2.17-maintenance";
agenix.url = "github:ryantm/agenix";
agenix-cli.url = "github:cole-h/agenix-cli";
ragenix.url = "github:yaxitech/ragenix";
deploy.url = "github:input-output-hk/deploy-rs";
terranix.url = "github:terranix/terranix";
terranix.inputs.nixpkgs.follows = "blank";
utils.url = "github:numtide/flake-utils";
blank.url = "github:divnix/blank";
# Vector >= 0.20.0 versions require nomad-follower watch-config format fix
nomad-follower.url = "github:input-output-hk/nomad-follower";
fenix.url = "github:nix-community/fenix";
ops-lib = {
url = "github:input-output-hk/ops-lib";
flake = false;
};
};
outputs = {
deploy,
fenix,
flake-arch,
nix,
nixpkgs,
nixpkgs-terraform,
nixpkgs-unstable,
ragenix,
self,
utils,
...
} @ inputs:
inputs.std.growOn {
inherit inputs;
inherit (inputs.flake-arch) systems;
cellsFrom = ./nix;
cellBlocks = [
(inputs.std.devshells "devshells")
(inputs.std.installables "packages")
# ----------
# NixOS: Modules, Profiles, Aggregates
# ----------
# profile aggregates - combine profiles into classes
# "composition over case switches"
(inputs.std.functions "aggregates")
# profiles - have side effects; don't define options
(inputs.std.functions "profiles")
# modules - have no side effects; define options
(inputs.std.functions "modules")
# ----------
# Terraform: loops
# ----------
# loops - reconcile a target state
(inputs.std.functions "loops")
];
}
# soil -- TODO: remove soil
(let
inherit (inputs.flake-arch) systems;
overlays = [
fenix.overlay
deploy.overlay
localPkgsOverlay
terraformProvidersOverlay
(_: prev: {inherit (self.packages."${prev.system}") bitte;})
];
terraformProvidersOverlay =
import ./terraform-providers-overlay.nix inputs;
localPkgsOverlay = import ./overlay.nix inputs;
pkgsForSystem = system:
import nixpkgs {
inherit overlays system;
config.allowUnfree = true; # for ssm-session-manager-plugin
};
unstablePkgsForSystem = system:
import nixpkgs-unstable {
inherit overlays system;
};
lib = import ./lib {
inherit (nixpkgs) lib;
inherit inputs;
};
mkChecks = systems: pkgs:
utils.lib.eachSystem systems (system: {
checks = builtins.foldl' (acc: pkg: acc // {${pkg} = (pkgsForSystem system).${pkg};}) {} pkgs;
});
in
utils.lib.eachSystem systems
(
system: let
legacyPackages = pkgsForSystem system;
unstablePackages = unstablePkgsForSystem system;
in rec {
inherit legacyPackages;
packages = {inherit (self.${system}.cli.packages) bitte;};
packages.default = packages.bitte;
}
)
// {
inherit lib;
# eta reduce not possibe since flake check validates for "final" / "prev"
overlays.default = nixpkgs.lib.composeManyExtensions overlays;
profiles = lib.mkModules ./profiles;
nixosModules = lib.mkModules ./modules;
devshellModule = import ./devshellModule.nix;
hydraJobs = builtins.mapAttrs (system: v: v // {
required = inputs.nixpkgs.legacyPackages.${system}.releaseTools.aggregate {
name = "required";
constituents = builtins.attrValues v;
};
}) (removeAttrs self.checks [
"aarch64-linux" # not supported on our Hydra instance
]);
}
// nixpkgs.lib.recursiveUpdate (mkChecks systems [
"agenix-cli"
"bitte"
"bitte-ruby"
"bundler"
"caddy"
"cfssl"
"consul"
"cue"
"docker-distribution"
"grafana-loki"
"mill"
"nomad"
"nomad-autoscaler"
"oauth2-proxy"
"ragenix"
"scaler-guard"
"sops"
"spiffe-helper"
"spire"
"spire-agent"
"spire-server"
"spire-systemd-attestor"
"terraform-with-plugins"
"traefik"
])
(mkChecks ["x86_64-linux"] [
"agenix"
"glusterfs"
"nomad-follower"
"vault-bin"
"victoriametrics"
"vault-backend"
]));
}