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