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