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