-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
439 lines (400 loc) · 12.9 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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.11";
nixpkgs-bacula.url = "github:RaHoni/nixpkgs/bacula";
nixpkgs-master.url = "github:NixOS/nixpkgs";
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager-stable = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
hydra.url = "github:NixOS/hydra";
impermanence.url = "github:nix-community/impermanence";
lanzaboote = {
url = "github:nix-community/lanzaboote";
inputs.nixpkgs.follows = "nixpkgs";
};
lanzaboote-stable = {
url = "github:nix-community/lanzaboote/v0.4.1";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
mprisRecord = {
url = "github:RaHoni/mprisRecord";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-on-droid = {
url = "github:nix-community/nix-on-droid/release-23.05";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
};
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim-stable = {
url = "github:nix-community/nixvim/nixos-24.11";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
plasma-manager = {
url = "github:nix-community/plasma-manager";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
};
plasma-manager-stable = {
url = "github:nix-community/plasma-manager";
inputs = {
nixpkgs.follows = "nixpkgs-stable";
home-manager.follows = "home-manager-stable";
};
};
pre-commit-hooks.url = "github:cachix/git-hooks.nix";
simple-mail-server = {
url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-24_11.follows = "nixpkgs-stable";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
streamdeck-obs = {
url = "github:RaHoni/streamdeck";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
stylix = {
url = "github:danth/stylix/release-24.11";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
};
nixConfig = {
extra-substituters = [
"https://binarycache.honermann.info"
];
extra-trusted-substituters = [
"https://binarycache.honermann.info"
];
extra-trusted-public-keys = [
"binarycache.honermann.info:ta4rxqLXx+RoTmZjybD96dm0fwcpTDQqFnF3HBRTeWg="
];
};
outputs =
{ self, systems, ... }@inputs:
with inputs;
let
inherit (inputs.nixpkgs.lib) filterAttrs mapAttrs elem;
getCfg = _: cfg: cfg.config.system.build.toplevel;
pkgsConfig =
pkgs: system:
import pkgs {
overlays = [
(import ./generic/overlays)
mprisRecord.overlays.${system}.default
];
inherit system;
config = {
allowUnfree = true; # allow Unfree packages
};
};
stable-nixpkgs = system: pkgsConfig nixpkgs-stable system;
overlays = system: final: prev: {
master = pkgsConfig nixpkgs-master system;
stable = pkgsConfig nixpkgs-stable system;
unstable = pkgsConfig nixpkgs system;
ffmpeg-vpl = import nixpkgs-stable {
overlays = [ (import ./generic/overlays/ffmpeg.nix) ];
inherit system;
config.allowUnfree = true;
modules = [
./generic
];
};
};
makeSystem =
{
systemModules,
homeManagerModules ? { },
stable ? true,
system ? "x86_64-linux",
nebula ? false,
secureboot ? false,
genericHomeManagerModules ? [ ],
...
}:
nixpkgs-stable.lib.nixosSystem rec {
pkgs = if stable then pkgsConfig nixpkgs-stable system else pkgsConfig nixpkgs system;
inherit system;
specialArgs = {
inherit
inputs
stable
nebula
secureboot
genericHomeManagerModules
; # ToDO: also make proxmox an option
inherit (hydra.packages.${system}) hydra;
homeManagerModules = nixpkgs.lib.attrsets.foldAttrs (item: acc: item ++ acc) [ ] [
{
root = [
./generic/users/root/home-manager.nix
];
}
homeManagerModules
];
};
modules = [
(
{ config, pkgs, ... }:
{
nixpkgs.overlays = [ (overlays system) ];
}
)
./generic/newDefault.nix
./generic/nebula.nix
] ++ systemModules;
};
# Small tool to iterate over each systems
eachSystem = f: nixpkgs.lib.genAttrs (import systems) (system: f nixpkgs.legacyPackages.${system});
in
rec {
nixosConfigurations = {
surface-raoul-nixos = makeSystem {
systemModules = [
./surface-raoul-nixos/configuration.nix
./generic/localisation.nix
#./generic/pipewire.nix
./generic/printer.nix
nixos-hardware.nixosModules.microsoft-surface-go
];
homeManagerModules = {
raoul = [
./surface-raoul-nixos/raoulHM.nix
plasma-manager-stable.homeManagerModules.plasma-manager
];
};
nebula = true;
};
raoul-framework = makeSystem {
systemModules = [
./raoul-framework/configuration.nix
./raoul-framework/disko.nix
./generic/localisation.nix
./generic/networking.nix
./generic/pipewire.nix
./generic/plasma.nix
./generic/printer.nix
./raoul-framework/hardwareconfig.nix
nixos-hardware.nixosModules.framework-16-7040-amd
stylix.nixosModules.stylix
];
homeManagerModules = {
raoul = [
plasma-manager-stable.homeManagerModules.plasma-manager
./generic/users/raoul/home-manager.nix
./generic/users/pandoc.nix
./generic/users/raoul/plasma6.nix
];
};
nebula = true;
secureboot = true;
};
r-desktop = makeSystem {
systemModules = [
./r-desktop/bacula.nix
./r-desktop/configuration.nix
./r-desktop/incron.nix
./r-desktop/pio.nix
./generic/intelgpu.nix
./generic/localisation.nix
./generic/pipewire.nix
./generic/plasma.nix
./generic/printer.nix
./server/esphome.nix
./server/github-runner.nix
./server/hydra.nix
];
homeManagerModules = {
raoul = [
./r-desktop/raoulHM.nix
plasma-manager-stable.homeManagerModules.plasma-manager
./generic/users/obs.nix
];
ffmpeg = [ ./generic/users ];
};
nebula = true;
stable = true;
};
jasmine-laptop = makeSystem {
systemModules = [
./jasmine/default.nix
];
homeManagerModules = {
jasmine = [ ./jasmine/jasmineHM.nix ];
};
nebula = true;
};
server = makeSystem {
nebula = true;
systemModules = [
inputs.impermanence.nixosModules.impermanence
./bacula/dir.nix
./bacula/sd.nix
./generic/smtp.nix
./server
./server/audiobookshelf.nix
./server/bacula.nix
./server/disko.nix
./server/factorio.nix
./server/home-assistant.nix
./server/nextcloud.nix
./server/pi-hole.nix
./server/pikaraoke.nix
];
};
vps = makeSystem {
systemModules = [
./vps
./generic/networking.nix
./nebula-lighthouse/nebula.nix
];
stable = true;
nebula = true;
};
petronillaStreaming = makeSystem {
systemModules = [
./petronillaStreaming/configuration.nix
./petronillaStreaming/users.nix
./generic/nvidea.nix
./generic/pipewire.nix
./generic/plasma.nix
];
homeManagerModules.streaming = [
./generic/users/default.nix
./generic/users/obs.nix
plasma-manager-stable.homeManagerModules.plasma-manager
./petronillaStreaming/hm-streaming.nix
];
nebula = true;
};
rescueIso = makeSystem {
systemModules = [
./rescueIso/configuration.nix
"${nixpkgs-stable}/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares-plasma5.nix"
];
homeManagerModules = {
nixos = [
./generic/users/default.nix
];
};
};
};
packages = {
x86_64-linux = rec {
default = installer;
installer = nixos-generators.nixosGenerate rec {
pkgs = pkgsConfig nixpkgs-stable system;
format = "install-iso";
system = "x86_64-linux";
modules = [
./generic/newDefault.nix
./generic/nebula.nix
./rescueIso/configuration.nix
"${nixpkgs-stable}/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares-plasma6.nix"
];
specialArgs = {
inherit system inputs;
nebula = false;
stable = true;
secureboot = false;
genericHomeManagerModules = [ ];
homeManagerModules = {
root = [ ./generic/users/root/home-manager.nix ];
nixos = [ ./generic/users/default.nix ];
};
};
};
arch-installer = nixos-generators.nixosGenerate rec {
pkgs = pkgsConfig nixpkgs-stable system;
format = "sd-aarch64-installer";
system = "aarch64-linux";
modules = [
./generic/newDefault.nix
./generic/nebula.nix
{ networking.hostName = "rescueIso"; }
];
specialArgs = {
inherit system inputs;
nebula = false;
stable = true;
secureboot = false;
genericHomeManagerModules = [ ];
homeManagerModules = {
root = [ ./generic/users/root/home-manager.nix ];
nixos = [ ./generic/users/default.nix ];
};
};
};
};
};
nixOnDroidConfigurations.fp4 = nix-on-droid.lib.nixOnDroidConfiguration {
system = "aarch64-linux";
pkgs = stable-nixpkgs "aarch64-linux";
modules = [
./fp4
./generic
home-manager-stable.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
backupFileExtension = "bak";
sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ];
imports = [
../generic/users/raoul/home-manager.nix
];
};
}
];
};
checks = nixpkgs.lib.genAttrs (import systems) (system: {
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
addGcRoot = true;
src = ./.;
hooks = {
nixfmt-rfc-style.enable = true;
};
};
});
devShells = nixpkgs.lib.genAttrs (import systems) (system: {
default = nixpkgs.legacyPackages.${system}.mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
buildInputs = self.checks.${system}.pre-commit-check.enabledPackages;
packages = with (stable-nixpkgs system); [ kdiff3 ];
};
});
formatter = eachSystem (pkgs: pkgs.nixfmt-rfc-style);
hydraJobs = {
# Include filtered configurations as Hydra jobs
hosts = mapAttrs getCfg nixosConfigurations;
#inherit (nixosConfigurations) r-desktop;
# Each filtered configuration is available as a job
inherit devShells packages;
};
images.raspberry = nixosConfigurations.aarch64-image.config.system.build.sdImage;
};
}