This repository has no description
16 kB
404 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 = "github:lassulus/covibe";
101 covibe.inputs.nixpkgs.follows = "nixpkgs";
102 # One omp revision (and one build) for covibe's patched omp 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 };
109
110 outputs =
111 inputs@{
112 self,
113 nixpkgs,
114 clan-core,
115 ...
116 }:
117 let
118 clan = clan-core.lib.clan {
119 self = self;
120 specialArgs.self = self;
121 modules = import ./clan_modules { inherit nixpkgs; };
122 vars.settings.secretStore = "password-store";
123 meta.domain = "s";
124 inventory = {
125 meta.name = "superconfig";
126 machines = {
127 ignavia.tags = [
128 "laptop"
129 "focus"
130 ];
131 mors.tags = [
132 "laptop"
133 "focus"
134 ];
135 aergia.tags = [
136 "laptop"
137 "focus"
138 ];
139 barnacle = {
140 machineClass = "darwin";
141 tags = [
142 "laptop"
143 "focus"
144 ];
145 };
146 icarus.tags = [ "laptop" ];
147 neoprism.tags = [ "server" ];
148 starkstrom = {
149 tags = [ "server" ];
150 deploy.forwardAgent = true;
151 };
152 acheron.tags = [ "server" ];
153 };
154 instances = {
155 tor = {
156 roles.server.tags.all = { };
157 };
158 retiolum = {
159 module.input = "self";
160 roles.default.tags.nixos = { };
161 };
162 internet = {
163 roles.default.machines = {
164 neoprism.settings.host = "neoprism.lassul.us";
165 neoprism.settings.port = 45621;
166 starkstrom.settings.host = "194.110.87.67";
167 starkstrom.settings.port = 45621;
168 };
169 };
170 state-version = {
171 module.name = "importer";
172 roles.default.tags.all = { };
173 roles.default.settings.extraModules = [
174 {
175 clan.core.state-version.enable = true;
176 }
177 ];
178 };
179 yggdrasil = {
180 roles.default.tags.nixos = { };
181 };
182 tor-yggdrasil = {
183 module.name = "tor";
184 roles.client.tags.nixos = { };
185 roles.server.tags.nixos = { };
186 roles.server.settings = {
187 secretHostname = false;
188 portMapping = [
189 {
190 # tcp
191 port = 6443;
192 target.port = 6443;
193 }
194 {
195 # tls
196 port = 6446;
197 target.port = 6443;
198 }
199 ];
200 };
201 };
202 };
203 };
204 machines =
205 nixpkgs.lib.mapAttrs
206 (machineName: _: {
207 imports = [
208 ./machines/${machineName}/physical.nix
209 ];
210 })
211 (
212 nixpkgs.lib.filterAttrs (
213 machineName: _: builtins.pathExists ./machines/${machineName}/physical.nix
214 ) (builtins.readDir ./machines)
215 );
216 };
217 in
218 clan-core.inputs.flake-parts.lib.mkFlake { inherit inputs; } {
219 systems = [
220 "x86_64-linux"
221 "aarch64-linux"
222 "aarch64-darwin"
223 "x86_64-darwin"
224 ];
225 imports = [
226 ./formatter.nix
227 ./5pkgs/flake-module.nix
228 ./keys/flake-module.nix
229 ./retiolum/flake-module.nix
230 ./skills/flake-module.nix
231 ./games/flake-module.nix
232
233 ./wrapperModules/pi/flake-module.nix
234 ./wrapperModules/claude-code/flake-module.nix
235 ./wrapperModules/noctalia-shell/flake-module.nix
236 {
237 options.flake.wrapperModules = nixpkgs.lib.mkOption {
238 type = nixpkgs.lib.types.lazyAttrsOf nixpkgs.lib.types.raw;
239 default = { };
240 };
241 }
242 ]
243 ++ (
244 # Auto-import all flake-module.nix files from tools subdirectories
245 let
246 toolDirs = builtins.attrNames (
247 nixpkgs.lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./tools)
248 );
249 in
250 map (dir: ./tools + "/${dir}/flake-module.nix") toolDirs
251 );
252 flake.nixosConfigurations = clan.config.nixosConfigurations;
253 flake.clanInternals = clan.config.clanInternals;
254 flake.darwinConfigurations = clan.config.darwinConfigurations;
255 flake.clan = clan.config;
256
257 # Container configurations for use with extra-container
258 # Auto-discovers machines with container.nix
259 flake.containerConfigurations =
260 nixpkgs.lib.mapAttrs
261 (machineName: _: import ./machines/${machineName}/container.nix { inherit self; })
262 (
263 nixpkgs.lib.filterAttrs (
264 machineName: _: builtins.pathExists ./machines/${machineName}/container.nix
265 ) (builtins.readDir ./machines)
266 );
267
268 perSystem =
269 {
270 lib,
271 pkgs,
272 system,
273 ...
274 }:
275 {
276 packages = {
277 default = inputs.le_menu.lib.buildMenu {
278 inherit pkgs;
279 menuConfig = {
280 vim.run = "nix run ${self}#nvim";
281 shell.run = "nix run ${self}#shell";
282 machines.submenu = lib.mapAttrs (name: _machine: {
283 submenu.ssh.submenu = {
284 retiolum.run = "ssh -t ${name}.r";
285 spora.run = "ssh ${name}.s";
286 nether.run = "ssh ${name}.n";
287 tor.run = "torify ssh $(pass show machines/${name}/tor-hostname)";
288 };
289 }) self.nixosConfigurations;
290 debug.run = "env";
291 };
292 };
293 clan-cli = clan-core.packages.${system}.clan-cli;
294 }
295 // lib.mapAttrs' (
296 name: containerConfig:
297 lib.nameValuePair "container-${name}" (
298 inputs.extra-container.lib.buildContainers {
299 inherit system;
300 nixpkgs = inputs.nixpkgs;
301 config = {
302 # Workaround: extra-container's minimal module set doesn't
303 # include nixos-init.nix, but systemd.nix now references
304 # config.system.nixos-init.package for env-generator.
305 # Provide a dummy option until extra-container is updated.
306
307 imports = [
308 (
309 { pkgs, lib, ... }:
310 {
311 options.system.nixos-init.package = lib.mkPackageOption pkgs "nixos-init" { };
312 options.time.timeZone = lib.mkOption {
313 type = lib.types.nullOr lib.types.str;
314 default = null;
315 description = "Dummy option for extra-container compatibility";
316 };
317 options.services.openssh = {
318 enable = lib.mkOption {
319 type = lib.types.bool;
320 default = false;
321 description = "Dummy option for extra-container compatibility";
322 };
323 package = lib.mkPackageOption pkgs "openssh" { };
324 };
325 # systemd.nix sets environment.variables.SYSTEMD_XKB_DIRECTORY,
326 # but the minimal module set omits config/system-environment.nix
327 # which declares the option.
328 options.environment.variables = lib.mkOption {
329 type = lib.types.attrsOf lib.types.anything;
330 default = { };
331 description = "Dummy option for extra-container compatibility";
332 };
333 # systemd.nix reads config.i18n.imperativeLocale, but the
334 # minimal module set omits config/i18n.nix which declares it.
335 options.i18n.imperativeLocale = lib.mkOption {
336 type = lib.types.bool;
337 default = true;
338 description = "Dummy option for extra-container compatibility";
339 };
340 # nixos-containers.nix reads config.nix.enable and
341 # config.nix.daemon.enable for the /nix/var/nix bind
342 # mounts, but the minimal module set omits
343 # config/nix.nix which declares them.
344 options.nix = {
345 enable = lib.mkOption {
346 type = lib.types.bool;
347 default = true;
348 description = "Dummy option for extra-container compatibility";
349 };
350 daemon.enable = lib.mkOption {
351 type = lib.types.bool;
352 default = true;
353 description = "Dummy option for extra-container compatibility";
354 };
355 };
356 }
357 )
358 ];
359 containers.${name} = containerConfig;
360 };
361 }
362 )
363 ) self.containerConfigurations;
364 devShells.default = pkgs.mkShell {
365 packages = [
366 self.packages.${pkgs.system}.pass
367 (self.legacyPackages.${system}.bin_shim {
368 name = "clan";
369 pkg_name = "clan-cli";
370 })
371 ];
372 };
373 legacyPackages.llm = inputs.llm-agents.packages.${system};
374 checks =
375 let
376 # Check NixOS configurations can be evaluated (without building)
377 nixosChecks = lib.mapAttrs' (
378 name: config:
379 lib.nameValuePair "nixos-${name}" (
380 pkgs.runCommand "eval-${name}" { } ''
381 # Force evaluation of the toplevel path without building
382 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.config.system.build.toplevel.drvPath}"
383 touch $out
384 ''
385 )
386 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.nixosConfigurations);
387
388 # Check Darwin configurations can be evaluated (without building)
389 darwinChecks = lib.mapAttrs' (
390 name: config:
391 lib.nameValuePair "darwin-${name}" (
392 pkgs.runCommand "eval-darwin-${name}" { } ''
393 # Force evaluation of the system path without building
394 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.system.drvPath}"
395 touch $out
396 ''
397 )
398 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.darwinConfigurations);
399 in
400 nixosChecks // darwinChecks;
401 };
402 flake.lib = import ./lib { inherit (nixpkgs) lib; };
403 };
404}