This repository has no description
0

Configure Feed

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

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