This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / flake.nix
17 kB 422 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 stockholm.url = "git+https://github.com/krebs/stockholm?submodules=1"; 32 # stockholm.url = "git+https://cgit.lassul.us/stockholm"; 33 # stockholm.url = "path:/home/lass/sync/stockholm"; 34 stockholm.inputs.nixpkgs.follows = "nixpkgs"; 35 stockholm.inputs.buildbot-nix.follows = ""; 36 37 # Host database only (modules/retiolum/hosts.nix), on every platform. 38 # The daemon is pkgs/tincr everywhere; barnacle imports tincr's own 39 # darwin module below, not kartei's retiolum shim. 40 kartei.url = "github:krebs/kartei"; 41 kartei.inputs.nixpkgs.follows = "nixpkgs"; 42 kartei.inputs.tincr.follows = "tincr"; 43 kartei.inputs.crane.follows = "tincr/crane"; 44 kartei.inputs.fenix.follows = "tincr/fenix"; 45 46 # Only for darwinModules.tincr (launchd plumbing); the package comes 47 # from pkgs/tincr, which pins the same fork branch. 48 tincr.url = "github:Lassulus/tincr/lassulus/fixes"; 49 tincr.inputs.nixpkgs.follows = "nixpkgs"; 50 tincr.inputs.treefmt-nix.follows = "treefmt-nix"; 51 52 disko.url = "github:nix-community/disko"; 53 # disko.url = "path:/home/lass/src/disko/"; 54 disko.inputs.nixpkgs.follows = "nixpkgs"; 55 56 nixos-hardware.url = "github:nixos/nixos-hardware"; 57 58 nether.url = "github:krebs/nether"; 59 # nether.url = "git+file:/home/lass/src/nether"; 60 nether.inputs.nixpkgs.follows = "nixpkgs"; 61 nether.inputs.clan-core.follows = "clan-core"; 62 nether.inputs.data-mesher.follows = ""; 63 64 spora.url = "github:krebs/spora"; 65 # spora.url = "git+file:/home/lass/src/spora"; 66 spora.inputs.nixpkgs.follows = "nixpkgs"; 67 68 nix-darwin.url = "github:LnL7/nix-darwin"; 69 nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; 70 71 nix-rosetta-builder.url = "github:cpick/nix-rosetta-builder"; 72 nix-rosetta-builder.inputs.nixpkgs.follows = "nixpkgs"; 73 74 nixos-facter.url = "github:numtide/nixos-facter-modules"; 75 76 treefmt-nix.url = "github:numtide/treefmt-nix"; 77 treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; 78 79 le_menu.url = "github:lassulus/le_menu"; 80 # le_menu.url = "git+file:/home/lass/src/le_menu"; 81 le_menu.inputs.nixpkgs.follows = "nixpkgs"; 82 83 extra-container.url = "github:erikarvstedt/extra-container"; 84 extra-container.inputs.nixpkgs.follows = "nixpkgs"; 85 86 llm-agents.url = "github:numtide/llm-agents.nix"; 87 llm-agents.inputs.nixpkgs.follows = "nixpkgs"; 88 89 hermes-agent.url = "github:nousresearch/hermes-agent"; 90 hermes-agent.inputs.nixpkgs.follows = "nixpkgs"; 91 92 nixpkgs-triage.url = "github:Lassulus/nixpkgs-triage"; 93 nixpkgs-triage.inputs.nixpkgs.follows = "nixpkgs"; 94 95 rogue-talk.url = "github:rogue-talk/rogue-talk"; 96 rogue-talk.inputs.nixpkgs.follows = "nixpkgs"; 97 98 wrappers.url = "github:lassulus/wrappers"; 99 # wrappers.url = "git+file:/home/lass/src/wrappers"; 100 wrappers.inputs.nixpkgs.follows = "nixpkgs"; 101 102 nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver"; 103 nixos-mailserver.inputs.nixpkgs.follows = "nixpkgs"; 104 105 sigexec.url = "git+https://git.geninf.io/Lassulus/sigexec"; 106 sigexec.inputs.nixpkgs.follows = "nixpkgs"; 107 108 # build farm (configs/nix-farm): remote builds over grpc:// ... 109 nix-grpc-store.url = "github:Mic92/nix-grpc-store"; 110 nix-grpc-store.inputs.nixpkgs.follows = "nixpkgs"; 111 nix-grpc-store.inputs.niks3.follows = "niks3"; 112 113 # ... and the S3-backed binary cache the outputs land in. Fork for 114 # `push --ignore-upstream-key` (not upstream yet). It rebases onto 115 # Mic92/niks3 daily (its .github/workflows/rebase-upstream.yml), so 116 # `nix flake update niks3` follows upstream. 117 niks3.url = "github:lassulus/niks3"; 118 niks3.inputs.nixpkgs.follows = "nixpkgs"; 119 niks3.inputs.treefmt-nix.follows = "treefmt-nix"; 120 121 }; 122 123 outputs = 124 inputs@{ 125 self, 126 nixpkgs, 127 clan-core, 128 ... 129 }: 130 let 131 clan = clan-core.lib.clan { 132 self = self; 133 specialArgs.self = self; 134 modules = import ./clan_modules { inherit nixpkgs; }; 135 vars.settings.secretStore = "password-store"; 136 meta.domain = "s"; 137 inventory = { 138 meta.name = "superconfig"; 139 machines = { 140 ignavia.tags = [ 141 "laptop" 142 "focus" 143 ]; 144 mors.tags = [ 145 "laptop" 146 "focus" 147 ]; 148 aergia.tags = [ 149 "laptop" 150 "focus" 151 ]; 152 barnacle = { 153 machineClass = "darwin"; 154 tags = [ 155 "laptop" 156 "focus" 157 ]; 158 }; 159 icarus.tags = [ "laptop" ]; 160 neoprism.tags = [ "server" ]; 161 starkstrom = { 162 tags = [ "server" ]; 163 deploy.forwardAgent = true; 164 }; 165 acheron.tags = [ "server" ]; 166 }; 167 instances = { 168 tor = { 169 roles.server.tags.all = { }; 170 }; 171 retiolum = { 172 module.input = "self"; 173 roles.default.tags.nixos = { }; 174 }; 175 internet = { 176 roles.default.machines = { 177 neoprism.settings.host = "neoprism.lassul.us"; 178 neoprism.settings.port = 45621; 179 starkstrom.settings.host = "194.110.87.67"; 180 starkstrom.settings.port = 45621; 181 }; 182 }; 183 state-version = { 184 module.name = "importer"; 185 roles.default.tags.all = { }; 186 roles.default.settings.extraModules = [ 187 { 188 clan.core.state-version.enable = true; 189 } 190 ]; 191 }; 192 yggdrasil = { 193 roles.default.tags.nixos = { }; 194 }; 195 tor-yggdrasil = { 196 module.name = "tor"; 197 roles.client.tags.nixos = { }; 198 roles.server.tags.nixos = { }; 199 roles.server.settings = { 200 secretHostname = false; 201 portMapping = [ 202 { 203 # tcp 204 port = 6443; 205 target.port = 6443; 206 } 207 { 208 # tls 209 port = 6446; 210 target.port = 6443; 211 } 212 ]; 213 }; 214 }; 215 }; 216 }; 217 machines = 218 nixpkgs.lib.mapAttrs 219 (machineName: _: { 220 imports = [ 221 ./machines/${machineName}/physical.nix 222 ]; 223 }) 224 ( 225 nixpkgs.lib.filterAttrs ( 226 machineName: _: builtins.pathExists ./machines/${machineName}/physical.nix 227 ) (builtins.readDir ./machines) 228 ); 229 }; 230 in 231 clan-core.inputs.flake-parts.lib.mkFlake { inherit inputs; } { 232 systems = [ 233 "x86_64-linux" 234 "aarch64-linux" 235 "aarch64-darwin" 236 "x86_64-darwin" 237 ]; 238 imports = [ 239 ./formatter.nix 240 ./pkgs/flake-module.nix 241 ./keys/flake-module.nix 242 ./retiolum/flake-module.nix 243 ./skills/flake-module.nix 244 245 ./wrapperModules/pi/flake-module.nix 246 ./wrapperModules/claude-code/flake-module.nix 247 ./wrapperModules/noctalia-shell/flake-module.nix 248 { 249 options.flake.wrapperModules = nixpkgs.lib.mkOption { 250 type = nixpkgs.lib.types.lazyAttrsOf nixpkgs.lib.types.raw; 251 default = { }; 252 }; 253 } 254 ] 255 ++ ( 256 # Auto-import all flake-module.nix files from tools subdirectories 257 let 258 toolDirs = builtins.attrNames ( 259 nixpkgs.lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./tools) 260 ); 261 in 262 map (dir: ./tools + "/${dir}/flake-module.nix") toolDirs 263 ); 264 flake.nixosConfigurations = clan.config.nixosConfigurations; 265 flake.clanInternals = clan.config.clanInternals; 266 flake.darwinConfigurations = clan.config.darwinConfigurations; 267 flake.clan = clan.config; 268 # clan-core imports data-mesher's module unconditionally; we don't run 269 # data-mesher or dm-dns, so an empty module stands in for it. 270 flake.nixosModules.data-mesher = { }; 271 272 # Container configurations for use with extra-container 273 # Auto-discovers machines with container.nix 274 flake.containerConfigurations = 275 nixpkgs.lib.mapAttrs 276 (machineName: _: import ./machines/${machineName}/container.nix { inherit self; }) 277 ( 278 nixpkgs.lib.filterAttrs ( 279 machineName: _: builtins.pathExists ./machines/${machineName}/container.nix 280 ) (builtins.readDir ./machines) 281 ); 282 283 perSystem = 284 { 285 lib, 286 pkgs, 287 system, 288 ... 289 }: 290 { 291 packages = { 292 default = inputs.le_menu.lib.buildMenu { 293 inherit pkgs; 294 menuConfig = { 295 vim.run = "nix run ${self}#nvim"; 296 shell.run = "nix run ${self}#shell"; 297 machines.submenu = lib.mapAttrs (name: _machine: { 298 submenu.ssh.submenu = { 299 retiolum.run = "ssh -t ${name}.r"; 300 spora.run = "ssh ${name}.s"; 301 nether.run = "ssh ${name}.n"; 302 tor.run = "torify ssh $(pass show machines/${name}/tor-hostname)"; 303 }; 304 }) self.nixosConfigurations; 305 debug.run = "env"; 306 }; 307 }; 308 clan-cli = clan-core.packages.${system}.clan-cli; 309 } 310 // lib.mapAttrs' ( 311 name: containerConfig: 312 lib.nameValuePair "container-${name}" ( 313 inputs.extra-container.lib.buildContainers { 314 inherit system; 315 nixpkgs = inputs.nixpkgs; 316 config = { 317 # Workaround: extra-container's minimal module set doesn't 318 # include nixos-init.nix, but systemd.nix now references 319 # config.system.nixos-init.package for env-generator. 320 # Provide a dummy option until extra-container is updated. 321 322 imports = [ 323 ( 324 { pkgs, lib, ... }: 325 { 326 options.system.nixos-init.package = lib.mkPackageOption pkgs "nixos-init" { }; 327 options.time.timeZone = lib.mkOption { 328 type = lib.types.nullOr lib.types.str; 329 default = null; 330 description = "Dummy option for extra-container compatibility"; 331 }; 332 options.services.openssh = { 333 enable = lib.mkOption { 334 type = lib.types.bool; 335 default = false; 336 description = "Dummy option for extra-container compatibility"; 337 }; 338 package = lib.mkPackageOption pkgs "openssh" { }; 339 }; 340 # systemd.nix sets environment.variables.SYSTEMD_XKB_DIRECTORY, 341 # but the minimal module set omits config/system-environment.nix 342 # which declares the option. 343 options.environment.variables = lib.mkOption { 344 type = lib.types.attrsOf lib.types.anything; 345 default = { }; 346 description = "Dummy option for extra-container compatibility"; 347 }; 348 # systemd.nix reads config.i18n.imperativeLocale, but the 349 # minimal module set omits config/i18n.nix which declares it. 350 options.i18n.imperativeLocale = lib.mkOption { 351 type = lib.types.bool; 352 default = true; 353 description = "Dummy option for extra-container compatibility"; 354 }; 355 # nixos-containers.nix reads config.nix.enable and 356 # config.nix.daemon.enable for the /nix/var/nix bind 357 # mounts, but the minimal module set omits 358 # config/nix.nix which declares them. 359 options.nix = { 360 enable = lib.mkOption { 361 type = lib.types.bool; 362 default = true; 363 description = "Dummy option for extra-container compatibility"; 364 }; 365 daemon.enable = lib.mkOption { 366 type = lib.types.bool; 367 default = true; 368 description = "Dummy option for extra-container compatibility"; 369 }; 370 }; 371 } 372 ) 373 ]; 374 containers.${name} = containerConfig; 375 }; 376 } 377 ) 378 ) self.containerConfigurations; 379 devShells.default = pkgs.mkShell { 380 packages = [ 381 self.packages.${pkgs.system}.pass 382 (self.legacyPackages.${system}.bin_shim { 383 name = "clan"; 384 pkg_name = "clan-cli"; 385 }) 386 ]; 387 }; 388 # orca: see pkgs/orca (darwin launcher fix). 389 legacyPackages.llm = 390 inputs.llm-agents.packages.${system} 391 // lib.optionalAttrs (self.packages.${system} ? orca) { inherit (self.packages.${system}) orca; }; 392 checks = 393 let 394 # Check NixOS configurations can be evaluated (without building) 395 nixosChecks = lib.mapAttrs' ( 396 name: config: 397 lib.nameValuePair "nixos-${name}" ( 398 pkgs.runCommand "eval-${name}" { } '' 399 # Force evaluation of the toplevel path without building 400 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.config.system.build.toplevel.drvPath}" 401 touch $out 402 '' 403 ) 404 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.nixosConfigurations); 405 406 # Check Darwin configurations can be evaluated (without building) 407 darwinChecks = lib.mapAttrs' ( 408 name: config: 409 lib.nameValuePair "darwin-${name}" ( 410 pkgs.runCommand "eval-darwin-${name}" { } '' 411 # Force evaluation of the system path without building 412 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.system.drvPath}" 413 touch $out 414 '' 415 ) 416 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.darwinConfigurations); 417 in 418 nixosChecks // darwinChecks; 419 }; 420 flake.lib = import ./lib { inherit (nixpkgs) lib; }; 421 }; 422}