This repository has no description
12 kB
319 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 # git.clan.lol is unreachable; use the GitHub mirrors.
21 clan-core.url = "github:clan-lol/clan-core";
22 # clan-core.url = "path:/Users/lassulus/src/clan/clan-core";
23 # clan-core.url = "path:/home/lass/src/clan/clan-core";
24 clan-core.inputs.nixpkgs.follows = "nixpkgs";
25 clan-core.inputs.disko.follows = "disko";
26 clan-core.inputs.nix-select.url = "github:clan-lol/nix-select";
27 # data-mesher has no GitHub mirror. "" makes clan-core use this flake as
28 # data-mesher; see the empty flake.nixosModules.data-mesher below.
29 clan-core.inputs.data-mesher.follows = "";
30
31 # Host database only (modules/retiolum/hosts.nix), on every platform.
32 # The daemon is pkgs/tincr everywhere; barnacle imports tincr's own
33 # darwin module below, not kartei's retiolum shim.
34 kartei.url = "github:krebs/kartei";
35 kartei.inputs.nixpkgs.follows = "nixpkgs";
36 kartei.inputs.tincr.follows = "tincr";
37 kartei.inputs.crane.follows = "tincr/crane";
38 kartei.inputs.fenix.follows = "tincr/fenix";
39
40 # Only for darwinModules.tincr (launchd plumbing); the package comes
41 # from pkgs/tincr, which pins the same fork branch.
42 tincr.url = "github:Lassulus/tincr/lassulus/fixes";
43 tincr.inputs.nixpkgs.follows = "nixpkgs";
44 tincr.inputs.treefmt-nix.follows = "treefmt-nix";
45
46 disko.url = "github:nix-community/disko";
47 # disko.url = "path:/home/lass/src/disko/";
48 disko.inputs.nixpkgs.follows = "nixpkgs";
49
50 nixos-hardware.url = "github:nixos/nixos-hardware";
51
52 spora.url = "github:krebs/spora";
53 # spora.url = "git+file:/home/lass/src/spora";
54 spora.inputs.nixpkgs.follows = "nixpkgs";
55
56 nix-rosetta-builder.url = "github:cpick/nix-rosetta-builder";
57 nix-rosetta-builder.inputs.nixpkgs.follows = "nixpkgs";
58
59 treefmt-nix.url = "github:numtide/treefmt-nix";
60 treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
61
62 le_menu.url = "github:lassulus/le_menu";
63 # le_menu.url = "git+file:/home/lass/src/le_menu";
64 le_menu.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 nixpkgs-triage.url = "github:Lassulus/nixpkgs-triage";
73 nixpkgs-triage.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 nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
80 nixos-mailserver.inputs.nixpkgs.follows = "nixpkgs";
81
82 sigexec.url = "git+https://git.geninf.io/Lassulus/sigexec";
83 sigexec.inputs.nixpkgs.follows = "nixpkgs";
84
85 # build farm (configs/nix-farm): remote builds over grpc:// ...
86 nix-grpc-store.url = "github:Mic92/nix-grpc-store";
87 nix-grpc-store.inputs.nixpkgs.follows = "nixpkgs";
88 nix-grpc-store.inputs.niks3.follows = "niks3";
89
90 # ... and the S3-backed binary cache the outputs land in. Fork for
91 # `push --ignore-upstream-key` (not upstream yet). It rebases onto
92 # Mic92/niks3 daily (its .github/workflows/rebase-upstream.yml), so
93 # `nix flake update niks3` follows upstream.
94 niks3.url = "github:lassulus/niks3";
95 niks3.inputs.nixpkgs.follows = "nixpkgs";
96 niks3.inputs.treefmt-nix.follows = "treefmt-nix";
97
98 };
99
100 outputs =
101 inputs@{
102 self,
103 nixpkgs,
104 clan-core,
105 ...
106 }:
107 let
108 clan = clan-core.lib.clan {
109 self = self;
110 specialArgs.self = self;
111 modules = import ./clan_modules { inherit nixpkgs; };
112 vars.settings.secretStore = "password-store";
113 meta.domain = "s";
114 inventory = {
115 meta.name = "superconfig";
116 machines = {
117 ignavia.tags = [
118 "laptop"
119 "focus"
120 ];
121 mors.tags = [
122 "laptop"
123 "focus"
124 ];
125 aergia.tags = [
126 "laptop"
127 "focus"
128 ];
129 barnacle = {
130 machineClass = "darwin";
131 tags = [
132 "laptop"
133 "focus"
134 ];
135 };
136 icarus.tags = [ "laptop" ];
137 neoprism.tags = [ "server" ];
138 starkstrom = {
139 tags = [ "server" ];
140 deploy.forwardAgent = true;
141 };
142 acheron.tags = [ "server" ];
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 ./pkgs/flake-module.nix
218 ./keys/flake-module.nix
219 ./retiolum/flake-module.nix
220 ./skills/flake-module.nix
221
222 ./wrapperModules/pi/flake-module.nix
223 ./wrapperModules/claude-code/flake-module.nix
224 ./wrapperModules/noctalia-shell/flake-module.nix
225 {
226 options.flake.wrapperModules = nixpkgs.lib.mkOption {
227 type = nixpkgs.lib.types.lazyAttrsOf nixpkgs.lib.types.raw;
228 default = { };
229 };
230 }
231 ]
232 ++ (
233 # Auto-import all flake-module.nix files from tools subdirectories
234 let
235 toolDirs = builtins.attrNames (
236 nixpkgs.lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./tools)
237 );
238 in
239 map (dir: ./tools + "/${dir}/flake-module.nix") toolDirs
240 );
241 flake.nixosConfigurations = clan.config.nixosConfigurations;
242 flake.clanInternals = clan.config.clanInternals;
243 flake.darwinConfigurations = clan.config.darwinConfigurations;
244 flake.clan = clan.config;
245 # clan-core imports data-mesher's module unconditionally; we don't run
246 # data-mesher or dm-dns, so an empty module stands in for it.
247 flake.nixosModules.data-mesher = { };
248
249 perSystem =
250 {
251 lib,
252 pkgs,
253 system,
254 ...
255 }:
256 {
257 packages = {
258 default = inputs.le_menu.lib.buildMenu {
259 inherit pkgs;
260 menuConfig = {
261 vim.run = "nix run ${self}#nvim";
262 shell.run = "nix run ${self}#shell";
263 machines.submenu = lib.mapAttrs (name: _machine: {
264 submenu.ssh.submenu = {
265 retiolum.run = "ssh -t ${name}.r";
266 spora.run = "ssh ${name}.s";
267 nether.run = "ssh ${name}.n";
268 tor.run = "torify ssh $(pass show machines/${name}/tor-hostname)";
269 };
270 }) self.nixosConfigurations;
271 debug.run = "env";
272 };
273 };
274 clan-cli = clan-core.packages.${system}.clan-cli;
275 };
276 devShells.default = pkgs.mkShell {
277 packages = [
278 self.packages.${pkgs.system}.pass
279 (self.legacyPackages.${system}.bin_shim {
280 name = "clan";
281 pkg_name = "clan-cli";
282 })
283 ];
284 };
285 # orca: see pkgs/orca (darwin launcher fix).
286 legacyPackages.llm =
287 inputs.llm-agents.packages.${system}
288 // lib.optionalAttrs (self.packages.${system} ? orca) { inherit (self.packages.${system}) orca; };
289 checks =
290 let
291 # Check NixOS configurations can be evaluated (without building)
292 nixosChecks = lib.mapAttrs' (
293 name: config:
294 lib.nameValuePair "nixos-${name}" (
295 pkgs.runCommand "eval-${name}" { } ''
296 # Force evaluation of the toplevel path without building
297 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.config.system.build.toplevel.drvPath}"
298 touch $out
299 ''
300 )
301 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.nixosConfigurations);
302
303 # Check Darwin configurations can be evaluated (without building)
304 darwinChecks = lib.mapAttrs' (
305 name: config:
306 lib.nameValuePair "darwin-${name}" (
307 pkgs.runCommand "eval-darwin-${name}" { } ''
308 # Force evaluation of the system path without building
309 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.system.drvPath}"
310 touch $out
311 ''
312 )
313 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.darwinConfigurations);
314 in
315 nixosChecks // darwinChecks;
316 };
317 flake.lib = import ./lib { inherit (nixpkgs) lib; };
318 };
319}