This repository has no description
0

Configure Feed

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

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