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