This repository has no description
11 kB
318 lines
1{
2 description = "lassulus superconfig";
3
4 inputs = {
5 nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
6 # nixpkgs.url = "github:lassulus/nixpkgs/nixos-unstable";
7 # nixpkgs.url = "path:/home/lass/tmp/nixpkgs-disk-debug";
8 # nixpkgs.url = "git+file:/home/lass/src/nixpkgs";
9 # nixpkgs.url = "git+file:/Users/lassulus/src/nixpkgs";
10
11 nix-index-database.url = "github:nix-community/nix-index-database";
12 nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
13
14 nixvim.url = "github:nix-community/nixvim";
15 nixvim.inputs.nixpkgs.follows = "nixpkgs";
16
17 clan-core.url = "git+https://git.clan.lol/clan/clan-core";
18 # clan-core.url = "path:/Users/lassulus/src/clan/clan-core";
19 # clan-core.url = "path:/home/lass/src/clan/clan-core";
20 clan-core.inputs.nixpkgs.follows = "nixpkgs";
21 clan-core.inputs.disko.follows = "disko";
22
23 stockholm.url = "git+https://github.com/krebs/stockholm?submodules=1";
24 # stockholm.url = "git+https://cgit.lassul.us/stockholm";
25 # stockholm.url = "path:/home/lass/sync/stockholm";
26 stockholm.inputs.nixpkgs.follows = "nixpkgs";
27 stockholm.inputs.buildbot-nix.follows = "";
28
29 disko.url = "github:nix-community/disko";
30 # disko.url = "path:/home/lass/src/disko/";
31 disko.inputs.nixpkgs.follows = "nixpkgs";
32
33 nixos-hardware.url = "github:nixos/nixos-hardware";
34
35 nether.url = "github:krebs/nether";
36 # nether.url = "git+file:/home/lass/src/nether";
37 nether.inputs.nixpkgs.follows = "nixpkgs";
38 nether.inputs.clan-core.follows = "clan-core";
39 nether.inputs.data-mesher.follows = "";
40
41 spora.url = "github:krebs/spora";
42 # spora.url = "git+file:/home/lass/src/spora";
43 spora.inputs.nixpkgs.follows = "nixpkgs";
44
45 nix-darwin.url = "github:LnL7/nix-darwin";
46 nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
47
48 nix-rosetta-builder.url = "github:cpick/nix-rosetta-builder";
49 nix-rosetta-builder.inputs.nixpkgs.follows = "nixpkgs";
50
51 nixos-facter.url = "github:numtide/nixos-facter-modules";
52
53 treefmt-nix.url = "github:numtide/treefmt-nix";
54 treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
55
56 le_menu.url = "github:lassulus/le_menu";
57 # le_menu.url = "git+file:/home/lass/src/le_menu";
58 le_menu.inputs.nixpkgs.follows = "nixpkgs";
59
60 extra-container.url = "github:erikarvstedt/extra-container";
61 extra-container.inputs.nixpkgs.follows = "nixpkgs";
62
63 llm-agents.url = "github:numtide/llm-agents.nix";
64 llm-agents.inputs.nixpkgs.follows = "nixpkgs";
65
66 rogue-talk.url = "github:rogue-talk/rogue-talk";
67 rogue-talk.inputs.nixpkgs.follows = "nixpkgs";
68
69 wrappers.url = "github:lassulus/wrappers";
70 # wrappers.url = "git+file:/home/lass/src/wrappers";
71 wrappers.inputs.nixpkgs.follows = "nixpkgs";
72
73 opencrow.url = "github:pinpox/opencrow";
74 opencrow.inputs.nixpkgs.follows = "nixpkgs";
75
76 nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/master";
77 nixos-mailserver.inputs.nixpkgs.follows = "nixpkgs";
78
79 kannix.url = "git+file:/home/lass/src/kannix";
80 kannix.inputs.nixpkgs.follows = "nixpkgs";
81 };
82
83 outputs =
84 inputs@{
85 self,
86 nixpkgs,
87 clan-core,
88 ...
89 }:
90 let
91 clan = clan-core.lib.clan {
92 self = self;
93 specialArgs.self = self;
94 modules = import ./clan_modules { inherit nixpkgs; };
95 vars.settings.secretStore = "password-store";
96 meta.domain = "s";
97 inventory = {
98 meta.name = "superconfig";
99 machines = {
100 ignavia.tags = [
101 "laptop"
102 "focus"
103 ];
104 mors.tags = [
105 "laptop"
106 "focus"
107 ];
108 aergia.tags = [
109 "laptop"
110 "focus"
111 ];
112 barnacle = {
113 machineClass = "darwin";
114 tags = [
115 "laptop"
116 "focus"
117 ];
118 };
119 icarus.tags = [ "laptop" ];
120 prism.tags = [ "server" ];
121 neoprism.tags = [ "server" ];
122 };
123 instances = {
124 tor = {
125 roles.server.tags.all = { };
126 };
127 internet = {
128 roles.default.machines = {
129 prism.settings.host = "prism.lassul.us";
130 prism.settings.port = 45621;
131 neoprism.settings.host = "neoprism.lassul.us";
132 neoprism.settings.port = 45621;
133 };
134 };
135 state-version = {
136 module.name = "importer";
137 roles.default.tags.all = { };
138 roles.default.settings.extraModules = [
139 {
140 clan.core.state-version.enable = true;
141 }
142 ];
143 };
144 yggdrasil = {
145 roles.default.tags.nixos = { };
146 };
147 tor-yggdrasil = {
148 module.name = "tor";
149 roles.client.tags.nixos = { };
150 roles.server.tags.nixos = { };
151 roles.server.settings = {
152 secretHostname = false;
153 portMapping = [
154 {
155 # tcp
156 port = 6443;
157 target.port = 6443;
158 }
159 {
160 # tls
161 port = 6446;
162 target.port = 6443;
163 }
164 ];
165 };
166 };
167 };
168 };
169 machines =
170 nixpkgs.lib.mapAttrs
171 (machineName: _: {
172 imports = [
173 ./machines/${machineName}/physical.nix
174 ];
175 })
176 (
177 nixpkgs.lib.filterAttrs (
178 machineName: _: builtins.pathExists ./machines/${machineName}/physical.nix
179 ) (builtins.readDir ./machines)
180 );
181 };
182 in
183 clan-core.inputs.flake-parts.lib.mkFlake { inherit inputs; } {
184 systems = [
185 "x86_64-linux"
186 "aarch64-linux"
187 "aarch64-darwin"
188 "x86_64-darwin"
189 ];
190 imports = [
191 ./formatter.nix
192 ./5pkgs/flake-module.nix
193 ./keys/flake-module.nix
194 ./skills/flake-module.nix
195 ./games/flake-module.nix
196
197 ./wrapperModules/pi/flake-module.nix
198 ]
199 ++ (
200 # Auto-import all flake-module.nix files from tools subdirectories
201 let
202 toolDirs = builtins.attrNames (
203 nixpkgs.lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./tools)
204 );
205 in
206 map (dir: ./tools + "/${dir}/flake-module.nix") toolDirs
207 );
208 flake.nixosConfigurations = clan.config.nixosConfigurations;
209 flake.clanInternals = clan.config.clanInternals;
210 flake.darwinConfigurations = clan.config.darwinConfigurations;
211 flake.clan = clan.config;
212
213 # Container configurations for use with extra-container
214 # Auto-discovers machines with container.nix
215 flake.containerConfigurations =
216 nixpkgs.lib.mapAttrs
217 (machineName: _: import ./machines/${machineName}/container.nix { inherit self; })
218 (
219 nixpkgs.lib.filterAttrs (
220 machineName: _: builtins.pathExists ./machines/${machineName}/container.nix
221 ) (builtins.readDir ./machines)
222 );
223
224 perSystem =
225 {
226 lib,
227 pkgs,
228 system,
229 ...
230 }:
231 {
232 packages = {
233 default = inputs.le_menu.lib.buildMenu {
234 inherit pkgs;
235 menuConfig = {
236 vim.run = "nix run ${self}#nvim";
237 shell.run = "nix run ${self}#shell";
238 machines.submenu = lib.mapAttrs (name: _machine: {
239 submenu.ssh.submenu = {
240 retiolum.run = "ssh -t ${name}.r";
241 spora.run = "ssh ${name}.s";
242 nether.run = "ssh ${name}.n";
243 tor.run = "torify ssh $(pass show machines/${name}/tor-hostname)";
244 };
245 }) self.nixosConfigurations;
246 debug.run = "env";
247 };
248 };
249 clan-cli = clan-core.packages.${system}.clan-cli;
250 }
251 // lib.mapAttrs' (
252 name: containerConfig:
253 lib.nameValuePair "container-${name}" (
254 inputs.extra-container.lib.buildContainers {
255 inherit system;
256 nixpkgs = inputs.nixpkgs;
257 config = {
258 # Workaround: extra-container's minimal module set doesn't
259 # include nixos-init.nix, but systemd.nix now references
260 # config.system.nixos-init.package for env-generator.
261 # Provide a dummy option until extra-container is updated.
262
263 imports = [
264 (
265 { pkgs, lib, ... }:
266 {
267 options.system.nixos-init.package = lib.mkPackageOption pkgs "nixos-init" { };
268 }
269 )
270 ];
271 containers.${name} = containerConfig;
272 };
273 }
274 )
275 ) self.containerConfigurations;
276 devShells.default = pkgs.mkShell {
277 packages = [
278 nixpkgs.legacyPackages.${system}.nil
279 nixpkgs.legacyPackages.${system}.nixd
280 self.packages.${pkgs.system}.pass
281 (self.legacyPackages.${system}.bin_shim {
282 name = "clan";
283 pkg_name = "clan-cli";
284 })
285 ];
286 };
287 legacyPackages.llm = inputs.llm-agents.packages.${system};
288 checks =
289 let
290 # Check NixOS configurations can be evaluated (without building)
291 nixosChecks = lib.mapAttrs' (
292 name: config:
293 lib.nameValuePair "nixos-${name}" (
294 pkgs.runCommand "eval-${name}" { } ''
295 # Force evaluation of the toplevel path without building
296 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.config.system.build.toplevel.drvPath}"
297 touch $out
298 ''
299 )
300 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.nixosConfigurations);
301
302 # Check Darwin configurations can be evaluated (without building)
303 darwinChecks = lib.mapAttrs' (
304 name: config:
305 lib.nameValuePair "darwin-${name}" (
306 pkgs.runCommand "eval-darwin-${name}" { } ''
307 # Force evaluation of the system path without building
308 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.system.drvPath}"
309 touch $out
310 ''
311 )
312 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.darwinConfigurations);
313 in
314 nixosChecks // darwinChecks;
315 };
316 flake.lib = import ./lib { inherit (nixpkgs) lib; };
317 };
318}