This repository has no description
11 kB
297 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 llm-agents.url = "github:numtide/llm-agents.nix";
63 llm-agents.inputs.nixpkgs.follows = "nixpkgs";
64
65 hermes-agent.url = "github:nousresearch/hermes-agent";
66 hermes-agent.inputs.nixpkgs.follows = "nixpkgs";
67
68 nixpkgs-triage.url = "github:Lassulus/nixpkgs-triage";
69 nixpkgs-triage.inputs.nixpkgs.follows = "nixpkgs";
70
71 wrappers.url = "github:lassulus/wrappers";
72 # wrappers.url = "git+file:/home/lass/src/wrappers";
73 wrappers.inputs.nixpkgs.follows = "nixpkgs";
74
75 nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
76 nixos-mailserver.inputs.nixpkgs.follows = "nixpkgs";
77
78 sigexec.url = "git+https://git.geninf.io/Lassulus/sigexec";
79 sigexec.inputs.nixpkgs.follows = "nixpkgs";
80
81 # build farm (configs/nix-farm): remote builds over grpc:// ...
82 nix-grpc-store.url = "github:Mic92/nix-grpc-store";
83 nix-grpc-store.inputs.nixpkgs.follows = "nixpkgs";
84 nix-grpc-store.inputs.niks3.follows = "niks3";
85
86 # ... and the S3-backed binary cache the outputs land in. Fork for
87 # `push --ignore-upstream-key` (not upstream yet). It rebases onto
88 # Mic92/niks3 daily (its .github/workflows/rebase-upstream.yml), so
89 # `nix flake update niks3` follows upstream.
90 niks3.url = "github:lassulus/niks3";
91 niks3.inputs.nixpkgs.follows = "nixpkgs";
92 niks3.inputs.treefmt-nix.follows = "treefmt-nix";
93
94 };
95
96 outputs =
97 inputs@{
98 self,
99 nixpkgs,
100 clan-core,
101 ...
102 }:
103 let
104 clan = clan-core.lib.clan {
105 self = self;
106 specialArgs.self = self;
107 modules = import ./clan_modules { inherit nixpkgs; };
108 vars.settings.secretStore = "password-store";
109 meta.domain = "s";
110 inventory = {
111 meta.name = "superconfig";
112 machines = {
113 ignavia.tags = [
114 "laptop"
115 "focus"
116 ];
117 mors.tags = [
118 "laptop"
119 "focus"
120 ];
121 aergia.tags = [
122 "laptop"
123 "focus"
124 ];
125 barnacle = {
126 machineClass = "darwin";
127 tags = [
128 "laptop"
129 "focus"
130 ];
131 };
132 icarus.tags = [ "laptop" ];
133 neoprism.tags = [ "server" ];
134 starkstrom = {
135 tags = [ "server" ];
136 deploy.forwardAgent = true;
137 };
138 acheron.tags = [ "server" ];
139 };
140 instances = {
141 tor = {
142 roles.server.tags.all = { };
143 };
144 retiolum = {
145 module.input = "self";
146 roles.default.tags.nixos = { };
147 };
148 internet = {
149 roles.default.machines = {
150 neoprism.settings.host = "neoprism.lassul.us";
151 neoprism.settings.port = 45621;
152 starkstrom.settings.host = "194.110.87.67";
153 starkstrom.settings.port = 45621;
154 };
155 };
156 state-version = {
157 module.name = "importer";
158 roles.default.tags.all = { };
159 roles.default.settings.extraModules = [
160 {
161 clan.core.state-version.enable = true;
162 }
163 ];
164 };
165 yggdrasil = {
166 roles.default.tags.nixos = { };
167 };
168 tor-yggdrasil = {
169 module.name = "tor";
170 roles.client.tags.nixos = { };
171 roles.server.tags.nixos = { };
172 roles.server.settings = {
173 secretHostname = false;
174 portMapping = [
175 {
176 # tcp
177 port = 6443;
178 target.port = 6443;
179 }
180 {
181 # tls
182 port = 6446;
183 target.port = 6443;
184 }
185 ];
186 };
187 };
188 };
189 };
190 machines =
191 nixpkgs.lib.mapAttrs
192 (machineName: _: {
193 imports = [
194 ./machines/${machineName}/physical.nix
195 ];
196 })
197 (
198 nixpkgs.lib.filterAttrs (
199 machineName: _: builtins.pathExists ./machines/${machineName}/physical.nix
200 ) (builtins.readDir ./machines)
201 );
202 };
203 in
204 clan-core.inputs.flake-parts.lib.mkFlake { inherit inputs; } {
205 systems = [
206 "x86_64-linux"
207 "aarch64-linux"
208 "aarch64-darwin"
209 "x86_64-darwin"
210 ];
211 imports = [
212 ./formatter.nix
213 ./pkgs/flake-module.nix
214 ./keys/flake-module.nix
215 ./retiolum/flake-module.nix
216 ./skills/flake-module.nix
217
218 ./wrapperModules/pi/flake-module.nix
219 ./wrapperModules/claude-code/flake-module.nix
220 ./wrapperModules/noctalia-shell/flake-module.nix
221 {
222 options.flake.wrapperModules = nixpkgs.lib.mkOption {
223 type = nixpkgs.lib.types.lazyAttrsOf nixpkgs.lib.types.raw;
224 default = { };
225 };
226 }
227 ]
228 ++ (
229 # Auto-import all flake-module.nix files from tools subdirectories
230 let
231 toolDirs = builtins.attrNames (
232 nixpkgs.lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./tools)
233 );
234 in
235 map (dir: ./tools + "/${dir}/flake-module.nix") toolDirs
236 );
237 flake.nixosConfigurations = clan.config.nixosConfigurations;
238 flake.clanInternals = clan.config.clanInternals;
239 flake.darwinConfigurations = clan.config.darwinConfigurations;
240 flake.clan = clan.config;
241 # clan-core imports data-mesher's module unconditionally; we don't run
242 # data-mesher or dm-dns, so an empty module stands in for it.
243 flake.nixosModules.data-mesher = { };
244
245 perSystem =
246 {
247 lib,
248 pkgs,
249 system,
250 ...
251 }:
252 {
253 packages.clan-cli = clan-core.packages.${system}.clan-cli;
254 devShells.default = pkgs.mkShell {
255 packages = [
256 self.packages.${pkgs.system}.pass
257 (self.legacyPackages.${system}.bin_shim {
258 name = "clan";
259 pkg_name = "clan-cli";
260 })
261 ];
262 };
263 # orca: see pkgs/orca (darwin launcher fix).
264 legacyPackages.llm =
265 inputs.llm-agents.packages.${system}
266 // lib.optionalAttrs (self.packages.${system} ? orca) { inherit (self.packages.${system}) orca; };
267 checks =
268 let
269 # Check NixOS configurations can be evaluated (without building)
270 nixosChecks = lib.mapAttrs' (
271 name: config:
272 lib.nameValuePair "nixos-${name}" (
273 pkgs.runCommand "eval-${name}" { } ''
274 # Force evaluation of the toplevel path without building
275 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.config.system.build.toplevel.drvPath}"
276 touch $out
277 ''
278 )
279 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.nixosConfigurations);
280
281 # Check Darwin configurations can be evaluated (without building)
282 darwinChecks = lib.mapAttrs' (
283 name: config:
284 lib.nameValuePair "darwin-${name}" (
285 pkgs.runCommand "eval-darwin-${name}" { } ''
286 # Force evaluation of the system path without building
287 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.system.drvPath}"
288 touch $out
289 ''
290 )
291 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.darwinConfigurations);
292 in
293 nixosChecks // darwinChecks;
294 };
295 flake.lib = import ./lib { inherit (nixpkgs) lib; };
296 };
297}