This repository has no description
10 kB
287 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-rebased";
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 # S3-backed binary cache cache.lassul.us (configs/nix-cache.nix), CI
75 # pushes its builds there. Fork for `push --ignore-upstream-key` (not
76 # upstream yet). It rebases onto
77 # Mic92/niks3 daily (its .github/workflows/rebase-upstream.yml), so
78 # `nix flake update niks3` follows upstream.
79 niks3.url = "github:lassulus/niks3";
80 niks3.inputs.nixpkgs.follows = "nixpkgs";
81 niks3.inputs.treefmt-nix.follows = "treefmt-nix";
82
83 byoidc.url = "github:lassulus/byoidc";
84 byoidc.inputs.nixpkgs.follows = "nixpkgs";
85 byoidc.inputs.treefmt-nix.follows = "treefmt-nix";
86
87 # Nix evaluator in Rust, CI evaluates the machines with its eval-jobs
88 # (.github/workflows/ci.yml). No import from derivation there.
89 iets.url = "github:numtide/iets";
90 iets.inputs.nixpkgs.follows = "nixpkgs";
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 ./skills/flake-module.nix
214
215 ./wrapperModules/pi/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 # The machine toplevels as plain derivations, for CI's build matrix
235 # (nix-eval-jobs, .github/workflows/ci.yml).
236 flake.ciToplevels = nixpkgs.lib.mapAttrs (
237 _: c: c.config.system.build.toplevel
238 ) clan.config.nixosConfigurations;
239 flake.clanInternals = clan.config.clanInternals;
240 flake.darwinConfigurations = clan.config.darwinConfigurations;
241 flake.clan = clan.config;
242 # clan-core imports data-mesher's module unconditionally; we don't run
243 # data-mesher or dm-dns, so an empty module stands in for it.
244 flake.nixosModules.data-mesher = { };
245
246 perSystem =
247 {
248 lib,
249 pkgs,
250 system,
251 ...
252 }:
253 {
254 packages.clan-cli = clan-core.packages.${system}.clan-cli;
255 # CI pushes its builds to cache.lassul.us with it (.github/niks3-push.sh)
256 packages.niks3 = inputs.niks3.packages.${system}.niks3;
257 # CI's eval job evaluates ciToplevels with it
258 packages.iets = inputs.iets.packages.${system}.default;
259 devShells.default = pkgs.mkShell {
260 packages = [
261 self.packages.${pkgs.system}.pass
262 (self.legacyPackages.${system}.bin_shim {
263 name = "clan";
264 pkg_name = "clan-cli";
265 })
266 ];
267 };
268 # orca: see pkgs/orca (darwin launcher fix).
269 legacyPackages.llm =
270 inputs.llm-agents.packages.${system}
271 // lib.optionalAttrs (self.packages.${system} ? orca) { inherit (self.packages.${system}) orca; };
272 # Check Darwin configurations can be evaluated (without building).
273 # The NixOS machines are built by .github/workflows/ci.yml (ciToplevels).
274 checks = lib.mapAttrs' (
275 name: config:
276 lib.nameValuePair "darwin-${name}" (
277 pkgs.runCommand "eval-darwin-${name}" { } ''
278 # Force evaluation of the system path without building
279 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.system.drvPath}"
280 touch $out
281 ''
282 )
283 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.darwinConfigurations);
284 };
285 flake.lib = import ./lib { inherit (nixpkgs) lib; };
286 };
287}