-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
102 lines (86 loc) · 2.98 KB
/
flake.nix
File metadata and controls
102 lines (86 loc) · 2.98 KB
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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
lix = {
url = "git+https://git@git.lix.systems/lix-project/lix";
};
lix-module = {
url = "git+https://git.lix.systems/lix-project/nixos-module";
inputs.lix.follows = "lix";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
comin.url = "github:nlewo/comin";
comin.inputs.nixpkgs.follows = "nixpkgs";
lanzaboote.url = "github:rv32ima/lanzaboote";
lanzaboote.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:nixos/nixos-hardware";
nixos-facter-modules.url = "github:numtide/nixos-facter-modules";
nix-index-database.url = "github:nix-community/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{
self,
lix-module,
nixpkgs,
disko,
nixos-facter-modules,
...
}@inputs:
{
nixosConfigurations = {
"proxmox" = self.lib.nixosSystem "proxmox";
"sea1-core" = self.lib.nixosSystem "sea1-core";
"fmt2-core" = self.lib.nixosSystem "fmt2-core";
"sea420-desktop" = self.lib.nixosSystem "sea420-desktop";
};
nixosModules = {
base = import ./machines/base.nix;
};
lib = {
vars = {
machines = import ./vars/machines.nix inputs;
};
nixosSystem =
machineName: self.lib.nixosSystem' machineName ./machines/${machineName}/configuration.nix;
nixosSystem' =
machineName: machineModule:
nixpkgs.lib.nixosSystem {
modules = [
{ networking.hostName = machineName; }
# inputs.sops-nix.nixosModules.default
self.nixosModules.base
machineModule
lix-module.nixosModules.default
inputs.nix-index-database.nixosModules.nix-index
];
specialArgs = {
inherit self inputs;
vars = self.lib.vars;
vars' = self.lib.vars.machines.${machineName} or { };
};
};
nixosModule =
name:
if builtins.pathExists ./modules/${name}/default.nix then
import ./modules/${name}/default.nix
else if builtins.pathExists ./modules/${name}.nix then
import ./modules/${name}.nix
else
throw "NixOS module '${name}' not found in modules directory";
diskoConfiguration =
machineName:
import ./machines/${machineName}/disko.nix {
inherit (nixpkgs) lib;
};
sdImageFromSystem = system: system.config.system.build.sdImage;
# machineNixpkgsSystem fetches the architecture (pkgs.system) for a
# given machine.
machineNixpkgsSystem = machineName: self.nixosConfigurations.${machineName}.config.nixpkgs.system;
};
};
}