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