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