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 430 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 253 ./wrapperModules/pi/flake-module.nix 254 ./wrapperModules/claude-code/flake-module.nix 255 ./wrapperModules/noctalia-shell/flake-module.nix 256 { 257 options.flake.wrapperModules = nixpkgs.lib.mkOption { 258 type = nixpkgs.lib.types.lazyAttrsOf nixpkgs.lib.types.raw; 259 default = { }; 260 }; 261 } 262 ] 263 ++ ( 264 # Auto-import all flake-module.nix files from tools subdirectories 265 let 266 toolDirs = builtins.attrNames ( 267 nixpkgs.lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./tools) 268 ); 269 in 270 map (dir: ./tools + "/${dir}/flake-module.nix") toolDirs 271 ); 272 flake.nixosConfigurations = clan.config.nixosConfigurations; 273 flake.clanInternals = clan.config.clanInternals; 274 flake.darwinConfigurations = clan.config.darwinConfigurations; 275 flake.clan = clan.config; 276 # clan-core imports data-mesher's module unconditionally; we don't run 277 # data-mesher or dm-dns, so an empty module stands in for it. 278 flake.nixosModules.data-mesher = { }; 279 280 # Container configurations for use with extra-container 281 # Auto-discovers machines with container.nix 282 flake.containerConfigurations = 283 nixpkgs.lib.mapAttrs 284 (machineName: _: import ./machines/${machineName}/container.nix { inherit self; }) 285 ( 286 nixpkgs.lib.filterAttrs ( 287 machineName: _: builtins.pathExists ./machines/${machineName}/container.nix 288 ) (builtins.readDir ./machines) 289 ); 290 291 perSystem = 292 { 293 lib, 294 pkgs, 295 system, 296 ... 297 }: 298 { 299 packages = { 300 default = inputs.le_menu.lib.buildMenu { 301 inherit pkgs; 302 menuConfig = { 303 vim.run = "nix run ${self}#nvim"; 304 shell.run = "nix run ${self}#shell"; 305 machines.submenu = lib.mapAttrs (name: _machine: { 306 submenu.ssh.submenu = { 307 retiolum.run = "ssh -t ${name}.r"; 308 spora.run = "ssh ${name}.s"; 309 nether.run = "ssh ${name}.n"; 310 tor.run = "torify ssh $(pass show machines/${name}/tor-hostname)"; 311 }; 312 }) self.nixosConfigurations; 313 debug.run = "env"; 314 }; 315 }; 316 clan-cli = clan-core.packages.${system}.clan-cli; 317 } 318 // lib.mapAttrs' ( 319 name: containerConfig: 320 lib.nameValuePair "container-${name}" ( 321 inputs.extra-container.lib.buildContainers { 322 inherit system; 323 nixpkgs = inputs.nixpkgs; 324 config = { 325 # Workaround: extra-container's minimal module set doesn't 326 # include nixos-init.nix, but systemd.nix now references 327 # config.system.nixos-init.package for env-generator. 328 # Provide a dummy option until extra-container is updated. 329 330 imports = [ 331 ( 332 { pkgs, lib, ... }: 333 { 334 options.system.nixos-init.package = lib.mkPackageOption pkgs "nixos-init" { }; 335 options.time.timeZone = lib.mkOption { 336 type = lib.types.nullOr lib.types.str; 337 default = null; 338 description = "Dummy option for extra-container compatibility"; 339 }; 340 options.services.openssh = { 341 enable = lib.mkOption { 342 type = lib.types.bool; 343 default = false; 344 description = "Dummy option for extra-container compatibility"; 345 }; 346 package = lib.mkPackageOption pkgs "openssh" { }; 347 }; 348 # systemd.nix sets environment.variables.SYSTEMD_XKB_DIRECTORY, 349 # but the minimal module set omits config/system-environment.nix 350 # which declares the option. 351 options.environment.variables = lib.mkOption { 352 type = lib.types.attrsOf lib.types.anything; 353 default = { }; 354 description = "Dummy option for extra-container compatibility"; 355 }; 356 # systemd.nix reads config.i18n.imperativeLocale, but the 357 # minimal module set omits config/i18n.nix which declares it. 358 options.i18n.imperativeLocale = lib.mkOption { 359 type = lib.types.bool; 360 default = true; 361 description = "Dummy option for extra-container compatibility"; 362 }; 363 # nixos-containers.nix reads config.nix.enable and 364 # config.nix.daemon.enable for the /nix/var/nix bind 365 # mounts, but the minimal module set omits 366 # config/nix.nix which declares them. 367 options.nix = { 368 enable = lib.mkOption { 369 type = lib.types.bool; 370 default = true; 371 description = "Dummy option for extra-container compatibility"; 372 }; 373 daemon.enable = lib.mkOption { 374 type = lib.types.bool; 375 default = true; 376 description = "Dummy option for extra-container compatibility"; 377 }; 378 }; 379 } 380 ) 381 ]; 382 containers.${name} = containerConfig; 383 }; 384 } 385 ) 386 ) self.containerConfigurations; 387 devShells.default = pkgs.mkShell { 388 packages = [ 389 self.packages.${pkgs.system}.pass 390 (self.legacyPackages.${system}.bin_shim { 391 name = "clan"; 392 pkg_name = "clan-cli"; 393 }) 394 ]; 395 }; 396 # orca: see pkgs/orca (darwin launcher fix). 397 legacyPackages.llm = 398 inputs.llm-agents.packages.${system} 399 // lib.optionalAttrs (self.packages.${system} ? orca) { inherit (self.packages.${system}) orca; }; 400 checks = 401 let 402 # Check NixOS configurations can be evaluated (without building) 403 nixosChecks = lib.mapAttrs' ( 404 name: config: 405 lib.nameValuePair "nixos-${name}" ( 406 pkgs.runCommand "eval-${name}" { } '' 407 # Force evaluation of the toplevel path without building 408 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.config.system.build.toplevel.drvPath}" 409 touch $out 410 '' 411 ) 412 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.nixosConfigurations); 413 414 # Check Darwin configurations can be evaluated (without building) 415 darwinChecks = lib.mapAttrs' ( 416 name: config: 417 lib.nameValuePair "darwin-${name}" ( 418 pkgs.runCommand "eval-darwin-${name}" { } '' 419 # Force evaluation of the system path without building 420 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.system.drvPath}" 421 touch $out 422 '' 423 ) 424 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.darwinConfigurations); 425 in 426 nixosChecks // darwinChecks; 427 }; 428 flake.lib = import ./lib { inherit (nixpkgs) lib; }; 429 }; 430}