This repository has no description
11 kB
321 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 };
80
81 outputs =
82 inputs@{
83 self,
84 nixpkgs,
85 clan-core,
86 ...
87 }:
88 let
89 clan = clan-core.lib.clan {
90 self = self;
91 specialArgs.self = self;
92 modules = import ./clan_modules { inherit nixpkgs; };
93 vars.settings.secretStore = "password-store";
94 meta.domain = "s";
95 inventory = {
96 meta.name = "superconfig";
97 machines = {
98 ignavia.tags = [
99 "laptop"
100 "focus"
101 ];
102 mors.tags = [
103 "laptop"
104 "focus"
105 ];
106 aergia.tags = [
107 "laptop"
108 "focus"
109 ];
110 barnacle = {
111 machineClass = "darwin";
112 tags = [
113 "laptop"
114 "focus"
115 ];
116 };
117 icarus.tags = [ "laptop" ];
118 prism.tags = [ "server" ];
119 neoprism.tags = [ "server" ];
120 };
121 instances = {
122 tor = {
123 roles.server.tags.all = { };
124 };
125 internet = {
126 roles.default.machines = {
127 prism.settings.host = "prism.lassul.us";
128 prism.settings.port = 45621;
129 neoprism.settings.host = "neoprism.lassul.us";
130 neoprism.settings.port = 45621;
131 };
132 };
133 state-version = {
134 module.name = "importer";
135 roles.default.tags.all = { };
136 roles.default.settings.extraModules = [
137 {
138 clan.core.state-version.enable = true;
139 }
140 ];
141 };
142 yggdrasil = {
143 roles.default.tags.nixos = { };
144 };
145 tor-yggdrasil = {
146 module.name = "tor";
147 roles.client.tags.nixos = { };
148 roles.server.tags.nixos = { };
149 roles.server.settings = {
150 secretHostname = false;
151 portMapping = [
152 {
153 # tcp
154 port = 6443;
155 target.port = 6443;
156 }
157 {
158 # tls
159 port = 6446;
160 target.port = 6443;
161 }
162 ];
163 };
164 };
165 };
166 };
167 machines =
168 nixpkgs.lib.mapAttrs
169 (machineName: _: {
170 imports = [
171 ./machines/${machineName}/physical.nix
172 ];
173 })
174 (
175 nixpkgs.lib.filterAttrs (
176 machineName: _: builtins.pathExists ./machines/${machineName}/physical.nix
177 ) (builtins.readDir ./machines)
178 );
179 };
180 in
181 clan-core.inputs.flake-parts.lib.mkFlake { inherit inputs; } {
182 systems = [
183 "x86_64-linux"
184 "aarch64-linux"
185 "aarch64-darwin"
186 "x86_64-darwin"
187 ];
188 imports = [
189 ./formatter.nix
190 ./5pkgs/flake-module.nix
191 ./keys/flake-module.nix
192 ./skills/flake-module.nix
193 ./games/flake-module.nix
194
195 ./wrapperModules/pi/flake-module.nix
196 ]
197 ++ (
198 # Auto-import all flake-module.nix files from tools subdirectories
199 let
200 toolDirs = builtins.attrNames (
201 nixpkgs.lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./tools)
202 );
203 in
204 map (dir: ./tools + "/${dir}/flake-module.nix") toolDirs
205 );
206 flake.nixosConfigurations = clan.config.nixosConfigurations;
207 flake.clanInternals = clan.config.clanInternals;
208 flake.darwinConfigurations = clan.config.darwinConfigurations;
209 flake.clan = clan.config;
210
211 # Container configurations for use with extra-container
212 # Auto-discovers machines with container.nix
213 flake.containerConfigurations =
214 nixpkgs.lib.mapAttrs
215 (machineName: _: import ./machines/${machineName}/container.nix { inherit self; })
216 (
217 nixpkgs.lib.filterAttrs (
218 machineName: _: builtins.pathExists ./machines/${machineName}/container.nix
219 ) (builtins.readDir ./machines)
220 );
221
222 perSystem =
223 {
224 lib,
225 pkgs,
226 system,
227 ...
228 }:
229 {
230 packages = {
231 default = inputs.le_menu.lib.buildMenu {
232 inherit pkgs;
233 menuConfig = {
234 vim.run = "nix run ${self}#nvim";
235 shell.run = "nix run ${self}#shell";
236 machines.submenu = lib.mapAttrs (name: _machine: {
237 submenu.ssh.submenu = {
238 retiolum.run = "ssh -t ${name}.r";
239 spora.run = "ssh ${name}.s";
240 nether.run = "ssh ${name}.n";
241 tor.run = "torify ssh $(pass show machines/${name}/tor-hostname)";
242 };
243 }) self.nixosConfigurations;
244 debug.run = "env";
245 };
246 };
247 clan-cli = clan-core.packages.${system}.clan-cli;
248 }
249 // lib.mapAttrs' (
250 name: containerConfig:
251 lib.nameValuePair "container-${name}" (
252 inputs.extra-container.lib.buildContainers {
253 inherit system;
254 nixpkgs = inputs.nixpkgs;
255 config = {
256 # Workaround: extra-container's minimal module set doesn't
257 # include nixos-init.nix, but systemd.nix now references
258 # config.system.nixos-init.package for env-generator.
259 # Provide a dummy option until extra-container is updated.
260
261 imports = [
262 (
263 { pkgs, lib, ... }:
264 {
265 options.system.nixos-init.package = lib.mkPackageOption pkgs "nixos-init" { };
266 options.time.timeZone = lib.mkOption {
267 type = lib.types.nullOr lib.types.str;
268 default = null;
269 description = "Dummy option for extra-container compatibility";
270 };
271 }
272 )
273 ];
274 containers.${name} = containerConfig;
275 };
276 }
277 )
278 ) self.containerConfigurations;
279 devShells.default = pkgs.mkShell {
280 packages = [
281 nixpkgs.legacyPackages.${system}.nil
282 nixpkgs.legacyPackages.${system}.nixd
283 self.packages.${pkgs.system}.pass
284 (self.legacyPackages.${system}.bin_shim {
285 name = "clan";
286 pkg_name = "clan-cli";
287 })
288 ];
289 };
290 legacyPackages.llm = inputs.llm-agents.packages.${system};
291 checks =
292 let
293 # Check NixOS configurations can be evaluated (without building)
294 nixosChecks = lib.mapAttrs' (
295 name: config:
296 lib.nameValuePair "nixos-${name}" (
297 pkgs.runCommand "eval-${name}" { } ''
298 # Force evaluation of the toplevel path without building
299 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.config.system.build.toplevel.drvPath}"
300 touch $out
301 ''
302 )
303 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.nixosConfigurations);
304
305 # Check Darwin configurations can be evaluated (without building)
306 darwinChecks = lib.mapAttrs' (
307 name: config:
308 lib.nameValuePair "darwin-${name}" (
309 pkgs.runCommand "eval-darwin-${name}" { } ''
310 # Force evaluation of the system path without building
311 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.system.drvPath}"
312 touch $out
313 ''
314 )
315 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.darwinConfigurations);
316 in
317 nixosChecks // darwinChecks;
318 };
319 flake.lib = import ./lib { inherit (nixpkgs) lib; };
320 };
321}