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