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