-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
195 lines (178 loc) · 5.45 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
{
description = "A library of useful Nix functions and types.";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixpkgs-unstable;
nix-darwin.url = github:LnL7/nix-darwin;
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
flake-compat = {
url = github:edolstra/flake-compat;
flake = false;
};
};
outputs =
{ self
, nixpkgs
, nix-darwin
, ...
}@inputs:
let
bootstrap = (import ./nix/overlays/000-bootstrap.nix) { } nixpkgs;
supportedSystems = [ "x86_64-linux" "x86_64-darwin" ];
forAllSupportedSystems = bootstrap.lib.flakes.forAllSystems supportedSystems;
pkgsFor = forAllSupportedSystems
(system:
import nixpkgs
{
inherit system;
config = {
allowUnfree = true;
allowBroken = true;
};
overlays = [ self.overlay ];
}
);
in
{
lib = pkgsFor.x86_64-linux.lib;
overlay =
let
overlaysFromDir = bootstrap.lib.overlays.combineFromDir ./nix/overlays;
in
bootstrap.lib.overlays.combine [
(final: prev:
{
lib = (prev.lib or { }) // {
flakes = (prev.lib.flakes or { }) // {
# For some reason, the nixpkgs flake doesn't roll its local
# lib.nixosSystem into nixpkgs.lib. We expose it here.
inherit (nixpkgs.lib) nixosSystem;
# Ditto for nix-darwin's lib.darwinSystem function.
inherit (nix-darwin.lib) darwinSystem;
};
};
}
)
overlaysFromDir
];
packages = forAllSupportedSystems
(system:
let
pkgs = pkgsFor.${system};
in
{
inherit (pkgs) ffdhe2048Pem ffdhe3072Pem ffdhe4096Pem;
}
);
hydraJobs = {
build = self.packages;
tests =
with import (nixpkgs + "/pkgs/top-level/release-lib.nix")
{
inherit supportedSystems;
scrubJobs = true;
nixpkgsArgs = {
config = {
allowUnfree = false;
allowBroken = true;
inHydra = true;
};
overlays = [
self.overlay
(import ./tests)
];
};
};
mapTestOn {
dlnCleanSourceNix = all;
dlnCleanSourceHaskell = all;
dlnCleanSourceSystemCruft = all;
dlnCleanSourceEditors = all;
dlnCleanSourceMaintainer = all;
dlnCleanSourceAllExtraneous = all;
dlnCleanPackageNix = all;
dlnCleanPackageHaskell = all;
dlnCleanPackageSystemCruft = all;
dlnCleanPackageEditors = all;
dlnCleanPackageMaintainer = all;
dlnCleanPackageAllExtraneous = all;
dlnAttrSets = all;
dlnIPAddr = all;
dlnMisc = all;
dlnFfdhe = all;
dlnTypes = all;
};
nixosConfigurations =
let
extraModules = [
{
boot.isContainer = true;
}
];
mkSystem = self.lib.flakes.nixosSystem' extraModules;
configs =
self.lib.flakes.nixosConfigurations.importFromDirectory
mkSystem
./test-configs/nixos
{
inherit (self) lib;
};
in
self.lib.flakes.nixosConfigurations.build configs;
amazonImages =
let
extraModules = [
{
ec2.hvm = true;
amazonImage.format = "qcow2";
amazonImage.sizeMB = 4096;
}
];
mkSystem = self.lib.flakes.amazonImage extraModules;
configs =
self.lib.flakes.nixosConfigurations.importFromDirectory
mkSystem
./test-configs/nixos
{
inherit (self) lib;
};
in
self.lib.flakes.nixosConfigurations.buildAmazonImages configs;
isoImages =
let
extraModules = [
{
isoImage.isoBaseName = self.lib.mkForce "hacknix-lib-test-iso";
}
];
mkSystem = self.lib.flakes.isoImage extraModules;
configs =
self.lib.flakes.nixosConfigurations.importFromDirectory
mkSystem
./test-configs/nixos
{
inherit (self) lib;
};
in
self.lib.flakes.nixosConfigurations.buildISOImages configs;
darwinConfigurations =
let
extraModules = [
{
services.nix-daemon.enable = true;
users.nix.configureBuildUsers = true;
users.nix.nrBuildUsers = 32;
}
];
mkSystem = self.lib.flakes.darwinSystem' extraModules;
configs =
self.lib.flakes.darwinConfigurations.importFromDirectory
mkSystem
./test-configs/nix-darwin
{
inherit (self) lib;
};
in
self.lib.flakes.darwinConfigurations.build configs;
};
};
}