-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
142 lines (132 loc) · 5.76 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
{ description = "Personal clan configs.";
inputs = {
nixpkgs.follows = "clan-core/nixpkgs";
flake-parts.follows = "clan-core/flake-parts";
clan-core.url = "https://git.clan.lol/clan/clan-core/archive/main.tar.gz";
nuenv.url = "github:DeterminateSystems/nuenv";
nixos-generators = { url = "github:nix-community/nixos-generators"; inputs.nixpkgs.follows = "nixpkgs"; };
home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; };
haumea = { url = "github:nix-community/haumea"; inputs.nixpkgs.follows = "nixpkgs"; };
lanzaboote = { url = "github:nix-community/lanzaboote"; inputs.nixpkgs.follows = "nixpkgs"; };
};
outputs = { self, clan-core, flake-parts, haumea, nixpkgs, ... }@inputs:
(flake-parts.lib.mkFlake { inherit inputs self; } ({config, lib, ... }:
let
renamePkgs = prefix: lib.mapAttrs' (n: v: lib.nameValuePair "${prefix}${lib.removePrefix prefix n}" v);
in
{
# Usage:
# - https://docs.clan.lol
# - https://docs.clan.lol/reference/nix-api/buildclan/
debug = true;
systems = ["x86_64-linux" "aarch64-linux"];
imports = [
clan-core.flakeModules.default
./hm
./nixos
];
clan = {
# Share `nixpkgs` between all systems.
# - Speeds up eval
# - Removes options: `nixpkgs.*`
# - Applies config & overlays
pkgsForSystem = import ./nixpkgs.nix inputs;
directory = inputs.self;
specialArgs = { inherit inputs self; };
meta.name = "Lehmanator";
machines = {
wyse = { imports = [ ./modules/shared.nix ./machines/wyse/configuration.nix ]; };
aio = { imports = [ ./modules/shared.nix ./machines/aio/configuration.nix ]; };
fw = { imports = [ ./modules/shared.nix ./machines/fw/configuration.nix ]; };
};
# Inventory Docs:
# - https://docs.clan.lol/guides/inventory/
# - https://docs.clan.lol/reference/nix-api/inventory/
# Build API schema: `nix build git+https://git.clan.lol/clan/clan-core#inventory-schema`
inventory = {
meta = {
name = "Lehmanator";
description = "Personal clan configs";
# icon = "./icon.png";
};
machines = {
fw = {
name = "fw";
description = "Framework Laptop 13";
icon = "./machines/fw/icon.svg";
tags = ["all" "laptop" "wifi"];
deploy.targetHost = "[email protected]";
};
wyse = {
name = "wyse";
description = "Dell Wyse Mini Desktop";
icon = "./machines/wyse/icon.svg";
tags = ["all" "desktop" "backup" "wifi"];
deploy.targetHost = "[email protected]";
};
aio = {
name = "aio";
description = "Dell Inspiron All-in-One Desktop";
icon = "./machines/aio/icon.svg";
tags = ["all" "desktop" "wifi"];
deploy.targetHost = "[email protected]";
};
};
services = {
admin.instance_1 = {
roles.default = {
tags = ["all"];
config.allowedKeys = {
aio = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK1iVBM368vGUuEWpHoYDwiD6pv8Tq1ZNGMdbD2jedUm sam@aio";
fw = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB2M80EUw0wQaBNutE06VNgSViVot6RL0O6iv2P1ewWH sam@fw";
wyse = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA7++n5ihP5vR4zCMcCJVZfwTJYI2LPl7yple9Ga7JZK sam@wyse";
fajita0 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICtA7S/6BSsGRTTcKU/9+Aa/VsPCJzNkfjHbvFlaSVKN";
flame = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILEUdU0TtRY9qdnJ/K0P/teEJ5OmTtY+utVkOqLVgh0Y";
cheetah = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHoHifjJL0fMBZDjNnXvSDhr0cwgkU80ybVeKRnly7Ku";
};
};
};
disk-id.instance_1.roles.default.tags = ["all"];
iwd.instance_1.roles.default = {
tags = ["wifi"];
config.networks = {
home.ssid = "Lehman";
hotspot.ssid = "hotspot-cheetah";
};
};
machine-id.instance_1.roles.default.tags = ["all"];
state-version.instance_1.roles.default.tags = ["all"];
};
};
};
perSystem = { pkgs, system, inputs', self', ... }: {
# Use our custom nixpkgs with overlays and config applied.
_module.args.pkgs = config.clan.pkgsForSystem system;
apps = {
app = { type="app"; program=self'.packages.clan-app; meta.description="GTK app to manage your clan"; };
cli = { type="app"; program=self'.packages.clan-cli; meta.description="CLI to manage your clan"; };
default = { type="app"; program=self'.packages.clan-cli; meta.description="CLI to manage your clan"; };
vm-manager = { type="app"; program=self'.packages.clan-vm-manager; meta.description="GTK app to manage clan VMs"; };
webview-ui = { type="app"; program=self'.packages.clan-webview-ui; meta.description="Web app to manage your clan"; };
};
devShells = inputs'.clan-core.devShells;
packages = (haumea.lib.load {
src = ./packages;
loader = haumea.lib.loaders.callPackage;
inputs = (builtins.removeAttrs pkgs ["root" "self" "super"]) //
inputs'.clan-core.packages // {
flakePath = self.outPath;
}
;
})
// (renamePkgs "clan-" inputs'.clan-core.packages)
;
};
flake = {
inherit inputs self;
# Inherit nixosConfigurations.installer from upstream clan-core.
# TODO: Auto-add SSH keys from other machines.
nixosConfigurations.clan-installer = clan-core.nixosConfigurations.flash-installer;
};
}));
}