This repository has no description
0

Configure Feed

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

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