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