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