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