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 # 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 };
88
89 outputs =
90 inputs@{
91 self,
92 nixpkgs,
93 clan-core,
94 ...
95 }:
96 let
97 clan = clan-core.lib.clan {
98 self = self;
99 specialArgs.self = self;
100 modules = import ./clan_modules { inherit nixpkgs; };
101 vars.settings.secretStore = "password-store";
102 meta.domain = "s";
103 inventory = {
104 meta.name = "superconfig";
105 machines = {
106 ignavia.tags = [
107 "laptop"
108 "focus"
109 ];
110 mors.tags = [
111 "laptop"
112 "focus"
113 ];
114 aergia.tags = [
115 "laptop"
116 "focus"
117 ];
118 barnacle = {
119 machineClass = "darwin";
120 tags = [
121 "laptop"
122 "focus"
123 ];
124 };
125 icarus.tags = [ "laptop" ];
126 neoprism.tags = [ "server" ];
127 starkstrom = {
128 tags = [ "server" ];
129 deploy.forwardAgent = true;
130 };
131 acheron.tags = [ "server" ];
132 };
133 instances = {
134 tor = {
135 roles.server.tags.all = { };
136 };
137 retiolum = {
138 module.input = "self";
139 roles.default.tags.nixos = { };
140 };
141 internet = {
142 roles.default.machines = {
143 neoprism.settings.host = "neoprism.lassul.us";
144 neoprism.settings.port = 45621;
145 starkstrom.settings.host = "194.110.87.67";
146 starkstrom.settings.port = 45621;
147 };
148 };
149 state-version = {
150 module.name = "importer";
151 roles.default.tags.all = { };
152 roles.default.settings.extraModules = [
153 {
154 clan.core.state-version.enable = true;
155 }
156 ];
157 };
158 yggdrasil = {
159 roles.default.tags.nixos = { };
160 };
161 tor-yggdrasil = {
162 module.name = "tor";
163 roles.client.tags.nixos = { };
164 roles.server.tags.nixos = { };
165 roles.server.settings = {
166 secretHostname = false;
167 portMapping = [
168 {
169 # tcp
170 port = 6443;
171 target.port = 6443;
172 }
173 {
174 # tls
175 port = 6446;
176 target.port = 6443;
177 }
178 ];
179 };
180 };
181 };
182 };
183 machines =
184 nixpkgs.lib.mapAttrs
185 (machineName: _: {
186 imports = [
187 ./machines/${machineName}/physical.nix
188 ];
189 })
190 (
191 nixpkgs.lib.filterAttrs (
192 machineName: _: builtins.pathExists ./machines/${machineName}/physical.nix
193 ) (builtins.readDir ./machines)
194 );
195 };
196 in
197 clan-core.inputs.flake-parts.lib.mkFlake { inherit inputs; } {
198 systems = [
199 "x86_64-linux"
200 "aarch64-linux"
201 "aarch64-darwin"
202 "x86_64-darwin"
203 ];
204 imports = [
205 ./formatter.nix
206 ./pkgs/flake-module.nix
207 ./keys/flake-module.nix
208 ./skills/flake-module.nix
209
210 ./wrapperModules/pi/flake-module.nix
211 ./wrapperModules/noctalia-shell/flake-module.nix
212 {
213 options.flake.wrapperModules = nixpkgs.lib.mkOption {
214 type = nixpkgs.lib.types.lazyAttrsOf nixpkgs.lib.types.raw;
215 default = { };
216 };
217 }
218 ]
219 ++ (
220 # Auto-import all flake-module.nix files from tools subdirectories
221 let
222 toolDirs = builtins.attrNames (
223 nixpkgs.lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./tools)
224 );
225 in
226 map (dir: ./tools + "/${dir}/flake-module.nix") toolDirs
227 );
228 flake.nixosConfigurations = clan.config.nixosConfigurations;
229 # The machine toplevels as plain derivations, for CI's build matrix
230 # (nix-eval-jobs, .github/workflows/ci.yml).
231 flake.ciToplevels = nixpkgs.lib.mapAttrs (
232 _: c: c.config.system.build.toplevel
233 ) 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 # CI pushes its builds to cache.lassul.us with it (.github/niks3-push.sh)
251 packages.niks3 = inputs.niks3.packages.${system}.niks3;
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 .github/workflows/ci.yml (ciToplevels).
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}