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