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