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