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