This repository has no description
0

Configure Feed

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

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