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