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