This repository has no description
14 kB
381 lines
1{
2 description = "lassulus superconfig";
3
4 inputs = {
5 # tracking nixos-unstable; if a bump lands an uncached firefox-devedition (beta channel
6 # isn't channel-gating on Hydra) it builds from source. Check first: s firefox-devedition-watch
7 # then pin a cached rev here if needed: github:nixos/nixpkgs/<rev>
8 nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
9 # nixpkgs.url = "github:lassulus/nixpkgs/nixos-unstable";
10 # nixpkgs.url = "path:/home/lass/tmp/nixpkgs-disk-debug";
11 # nixpkgs.url = "git+file:/home/lass/src/nixpkgs";
12 # nixpkgs.url = "git+file:/Users/lassulus/src/nixpkgs";
13
14 nix-index-database.url = "github:nix-community/nix-index-database";
15 nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
16
17 nixvim.url = "github:nix-community/nixvim";
18 nixvim.inputs.nixpkgs.follows = "nixpkgs";
19
20 clan-core.url = "git+https://git.clan.lol/clan/clan-core";
21 # clan-core.url = "path:/Users/lassulus/src/clan/clan-core";
22 # clan-core.url = "path:/home/lass/src/clan/clan-core";
23 clan-core.inputs.nixpkgs.follows = "nixpkgs";
24 clan-core.inputs.disko.follows = "disko";
25
26 stockholm.url = "git+https://github.com/krebs/stockholm?submodules=1";
27 # stockholm.url = "git+https://cgit.lassul.us/stockholm";
28 # stockholm.url = "path:/home/lass/sync/stockholm";
29 stockholm.inputs.nixpkgs.follows = "nixpkgs";
30 stockholm.inputs.buildbot-nix.follows = "";
31
32 # Host database + retiolum modules. barnacle (darwin) consumes these
33 # directly; the NixOS machines still get their host data through
34 # stockholm's older kartei pin.
35 kartei.url = "github:krebs/kartei";
36 kartei.inputs.nixpkgs.follows = "nixpkgs";
37
38 disko.url = "github:nix-community/disko";
39 # disko.url = "path:/home/lass/src/disko/";
40 disko.inputs.nixpkgs.follows = "nixpkgs";
41
42 nixos-hardware.url = "github:nixos/nixos-hardware";
43
44 nether.url = "github:krebs/nether";
45 # nether.url = "git+file:/home/lass/src/nether";
46 nether.inputs.nixpkgs.follows = "nixpkgs";
47 nether.inputs.clan-core.follows = "clan-core";
48 nether.inputs.data-mesher.follows = "";
49
50 spora.url = "github:krebs/spora";
51 # spora.url = "git+file:/home/lass/src/spora";
52 spora.inputs.nixpkgs.follows = "nixpkgs";
53
54 nix-darwin.url = "github:LnL7/nix-darwin";
55 nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
56
57 nix-rosetta-builder.url = "github:cpick/nix-rosetta-builder";
58 nix-rosetta-builder.inputs.nixpkgs.follows = "nixpkgs";
59
60 nixos-facter.url = "github:numtide/nixos-facter-modules";
61
62 treefmt-nix.url = "github:numtide/treefmt-nix";
63 treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
64
65 le_menu.url = "github:lassulus/le_menu";
66 # le_menu.url = "git+file:/home/lass/src/le_menu";
67 le_menu.inputs.nixpkgs.follows = "nixpkgs";
68
69 extra-container.url = "github:erikarvstedt/extra-container";
70 extra-container.inputs.nixpkgs.follows = "nixpkgs";
71
72 llm-agents.url = "github:numtide/llm-agents.nix";
73 llm-agents.inputs.nixpkgs.follows = "nixpkgs";
74
75 hermes-agent.url = "github:nousresearch/hermes-agent";
76 hermes-agent.inputs.nixpkgs.follows = "nixpkgs";
77
78 rogue-talk.url = "github:rogue-talk/rogue-talk";
79 rogue-talk.inputs.nixpkgs.follows = "nixpkgs";
80
81 wrappers.url = "github:lassulus/wrappers";
82 # wrappers.url = "git+file:/home/lass/src/wrappers";
83 wrappers.inputs.nixpkgs.follows = "nixpkgs";
84
85 opencrow.url = "github:pinpox/opencrow";
86 opencrow.inputs.nixpkgs.follows = "nixpkgs";
87
88 nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
89 nixos-mailserver.inputs.nixpkgs.follows = "nixpkgs";
90
91 covibe.url = "github:lassulus/covibe";
92 covibe.inputs.nixpkgs.follows = "nixpkgs";
93 # One omp revision (and one build) for covibe's patched omp and llm.omp.
94 covibe.inputs.llm-agents.follows = "llm-agents";
95
96 sigexec.url = "git+https://git.geninf.io/Lassulus/sigexec";
97 sigexec.inputs.nixpkgs.follows = "nixpkgs";
98
99 };
100
101 outputs =
102 inputs@{
103 self,
104 nixpkgs,
105 clan-core,
106 ...
107 }:
108 let
109 clan = clan-core.lib.clan {
110 self = self;
111 specialArgs.self = self;
112 modules = import ./clan_modules { inherit nixpkgs; };
113 vars.settings.secretStore = "password-store";
114 meta.domain = "s";
115 inventory = {
116 meta.name = "superconfig";
117 machines = {
118 ignavia.tags = [
119 "laptop"
120 "focus"
121 ];
122 mors.tags = [
123 "laptop"
124 "focus"
125 ];
126 aergia.tags = [
127 "laptop"
128 "focus"
129 ];
130 barnacle = {
131 machineClass = "darwin";
132 tags = [
133 "laptop"
134 "focus"
135 ];
136 };
137 icarus.tags = [ "laptop" ];
138 prism.tags = [ "server" ];
139 neoprism.tags = [ "server" ];
140 starkstrom = {
141 tags = [ "server" ];
142 deploy.forwardAgent = true;
143 };
144 };
145 instances = {
146 tor = {
147 roles.server.tags.all = { };
148 };
149 retiolum = {
150 module.input = "self";
151 roles.default.tags.nixos = { };
152 };
153 internet = {
154 roles.default.machines = {
155 prism.settings.host = "prism.lassul.us";
156 prism.settings.port = 45621;
157 neoprism.settings.host = "neoprism.lassul.us";
158 neoprism.settings.port = 45621;
159 starkstrom.settings.host = "194.110.87.67";
160 starkstrom.settings.port = 45621;
161 };
162 };
163 state-version = {
164 module.name = "importer";
165 roles.default.tags.all = { };
166 roles.default.settings.extraModules = [
167 {
168 clan.core.state-version.enable = true;
169 }
170 ];
171 };
172 yggdrasil = {
173 roles.default.tags.nixos = { };
174 };
175 tor-yggdrasil = {
176 module.name = "tor";
177 roles.client.tags.nixos = { };
178 roles.server.tags.nixos = { };
179 roles.server.settings = {
180 secretHostname = false;
181 portMapping = [
182 {
183 # tcp
184 port = 6443;
185 target.port = 6443;
186 }
187 {
188 # tls
189 port = 6446;
190 target.port = 6443;
191 }
192 ];
193 };
194 };
195 };
196 };
197 machines =
198 nixpkgs.lib.mapAttrs
199 (machineName: _: {
200 imports = [
201 ./machines/${machineName}/physical.nix
202 ];
203 })
204 (
205 nixpkgs.lib.filterAttrs (
206 machineName: _: builtins.pathExists ./machines/${machineName}/physical.nix
207 ) (builtins.readDir ./machines)
208 );
209 };
210 in
211 clan-core.inputs.flake-parts.lib.mkFlake { inherit inputs; } {
212 systems = [
213 "x86_64-linux"
214 "aarch64-linux"
215 "aarch64-darwin"
216 "x86_64-darwin"
217 ];
218 imports = [
219 ./formatter.nix
220 ./5pkgs/flake-module.nix
221 ./keys/flake-module.nix
222 ./retiolum/flake-module.nix
223 ./skills/flake-module.nix
224 ./games/flake-module.nix
225
226 ./wrapperModules/pi/flake-module.nix
227 ./wrapperModules/claude-code/flake-module.nix
228 ./wrapperModules/noctalia-shell/flake-module.nix
229 {
230 options.flake.wrapperModules = nixpkgs.lib.mkOption {
231 type = nixpkgs.lib.types.lazyAttrsOf nixpkgs.lib.types.raw;
232 default = { };
233 };
234 }
235 ]
236 ++ (
237 # Auto-import all flake-module.nix files from tools subdirectories
238 let
239 toolDirs = builtins.attrNames (
240 nixpkgs.lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./tools)
241 );
242 in
243 map (dir: ./tools + "/${dir}/flake-module.nix") toolDirs
244 );
245 flake.nixosConfigurations = clan.config.nixosConfigurations;
246 flake.clanInternals = clan.config.clanInternals;
247 flake.darwinConfigurations = clan.config.darwinConfigurations;
248 flake.clan = clan.config;
249
250 # Container configurations for use with extra-container
251 # Auto-discovers machines with container.nix
252 flake.containerConfigurations =
253 nixpkgs.lib.mapAttrs
254 (machineName: _: import ./machines/${machineName}/container.nix { inherit self; })
255 (
256 nixpkgs.lib.filterAttrs (
257 machineName: _: builtins.pathExists ./machines/${machineName}/container.nix
258 ) (builtins.readDir ./machines)
259 );
260
261 perSystem =
262 {
263 lib,
264 pkgs,
265 system,
266 ...
267 }:
268 {
269 packages = {
270 default = inputs.le_menu.lib.buildMenu {
271 inherit pkgs;
272 menuConfig = {
273 vim.run = "nix run ${self}#nvim";
274 shell.run = "nix run ${self}#shell";
275 machines.submenu = lib.mapAttrs (name: _machine: {
276 submenu.ssh.submenu = {
277 retiolum.run = "ssh -t ${name}.r";
278 spora.run = "ssh ${name}.s";
279 nether.run = "ssh ${name}.n";
280 tor.run = "torify ssh $(pass show machines/${name}/tor-hostname)";
281 };
282 }) self.nixosConfigurations;
283 debug.run = "env";
284 };
285 };
286 clan-cli = clan-core.packages.${system}.clan-cli;
287 }
288 // lib.mapAttrs' (
289 name: containerConfig:
290 lib.nameValuePair "container-${name}" (
291 inputs.extra-container.lib.buildContainers {
292 inherit system;
293 nixpkgs = inputs.nixpkgs;
294 config = {
295 # Workaround: extra-container's minimal module set doesn't
296 # include nixos-init.nix, but systemd.nix now references
297 # config.system.nixos-init.package for env-generator.
298 # Provide a dummy option until extra-container is updated.
299
300 imports = [
301 (
302 { pkgs, lib, ... }:
303 {
304 options.system.nixos-init.package = lib.mkPackageOption pkgs "nixos-init" { };
305 options.time.timeZone = lib.mkOption {
306 type = lib.types.nullOr lib.types.str;
307 default = null;
308 description = "Dummy option for extra-container compatibility";
309 };
310 options.services.openssh = {
311 enable = lib.mkOption {
312 type = lib.types.bool;
313 default = false;
314 description = "Dummy option for extra-container compatibility";
315 };
316 package = lib.mkPackageOption pkgs "openssh" { };
317 };
318 # systemd.nix sets environment.variables.SYSTEMD_XKB_DIRECTORY,
319 # but the minimal module set omits config/system-environment.nix
320 # which declares the option.
321 options.environment.variables = lib.mkOption {
322 type = lib.types.attrsOf lib.types.anything;
323 default = { };
324 description = "Dummy option for extra-container compatibility";
325 };
326 # systemd.nix reads config.i18n.imperativeLocale, but the
327 # minimal module set omits config/i18n.nix which declares it.
328 options.i18n.imperativeLocale = lib.mkOption {
329 type = lib.types.bool;
330 default = true;
331 description = "Dummy option for extra-container compatibility";
332 };
333 }
334 )
335 ];
336 containers.${name} = containerConfig;
337 };
338 }
339 )
340 ) self.containerConfigurations;
341 devShells.default = pkgs.mkShell {
342 packages = [
343 self.packages.${pkgs.system}.pass
344 (self.legacyPackages.${system}.bin_shim {
345 name = "clan";
346 pkg_name = "clan-cli";
347 })
348 ];
349 };
350 legacyPackages.llm = inputs.llm-agents.packages.${system};
351 checks =
352 let
353 # Check NixOS configurations can be evaluated (without building)
354 nixosChecks = lib.mapAttrs' (
355 name: config:
356 lib.nameValuePair "nixos-${name}" (
357 pkgs.runCommand "eval-${name}" { } ''
358 # Force evaluation of the toplevel path without building
359 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.config.system.build.toplevel.drvPath}"
360 touch $out
361 ''
362 )
363 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.nixosConfigurations);
364
365 # Check Darwin configurations can be evaluated (without building)
366 darwinChecks = lib.mapAttrs' (
367 name: config:
368 lib.nameValuePair "darwin-${name}" (
369 pkgs.runCommand "eval-darwin-${name}" { } ''
370 # Force evaluation of the system path without building
371 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.system.drvPath}"
372 touch $out
373 ''
374 )
375 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.darwinConfigurations);
376 in
377 nixosChecks // darwinChecks;
378 };
379 flake.lib = import ./lib { inherit (nixpkgs) lib; };
380 };
381}