This repository has no description
0

Configure Feed

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

superconfig / flake.nix
9.7 kB 280 lines
1{ 2 description = "lassulus superconfig"; 3 4 inputs = { 5 nixpkgs.url = "github:nixos/nixpkgs/e4bae1bd10c9c57b2cf517953ab70060a828ee6f"; 6 # nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; 7 # nixpkgs.url = "github:lassulus/nixpkgs/nixos-unstable"; 8 # nixpkgs.url = "path:/home/lass/tmp/nixpkgs-disk-debug"; 9 # nixpkgs.url = "git+file:/home/lass/src/nixpkgs"; 10 # nixpkgs.url = "git+file:/Users/lassulus/src/nixpkgs"; 11 12 nix-index-database.url = "github:nix-community/nix-index-database"; 13 nix-index-database.inputs.nixpkgs.follows = "nixpkgs"; 14 15 nixvim.url = "github:nix-community/nixvim"; 16 nixvim.inputs.nixpkgs.follows = "nixpkgs"; 17 18 clan-core.url = "git+https://git.clan.lol/clan/clan-core"; 19 # clan-core.url = "path:/Users/lassulus/src/clan/clan-core"; 20 # clan-core.url = "path:/home/lass/src/clan/clan-core"; 21 clan-core.inputs.nixpkgs.follows = "nixpkgs"; 22 clan-core.inputs.disko.follows = "disko"; 23 24 stockholm.url = "git+https://github.com/krebs/stockholm?submodules=1"; 25 # stockholm.url = "git+https://cgit.lassul.us/stockholm"; 26 # stockholm.url = "path:/home/lass/sync/stockholm"; 27 stockholm.inputs.nixpkgs.follows = "nixpkgs"; 28 stockholm.inputs.buildbot-nix.follows = ""; 29 30 disko.url = "github:nix-community/disko"; 31 # disko.url = "path:/home/lass/src/disko/"; 32 disko.inputs.nixpkgs.follows = "nixpkgs"; 33 34 nixos-hardware.url = "github:nixos/nixos-hardware"; 35 36 nether.url = "github:krebs/nether"; 37 # nether.url = "git+file:/home/lass/src/nether"; 38 nether.inputs.nixpkgs.follows = "nixpkgs"; 39 nether.inputs.clan-core.follows = "clan-core"; 40 nether.inputs.data-mesher.follows = ""; 41 42 spora.url = "github:krebs/spora"; 43 # spora.url = "git+file:/home/lass/src/spora"; 44 spora.inputs.nixpkgs.follows = "nixpkgs"; 45 46 nix-darwin.url = "github:LnL7/nix-darwin"; 47 nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; 48 49 nix-rosetta-builder.url = "github:cpick/nix-rosetta-builder"; 50 nix-rosetta-builder.inputs.nixpkgs.follows = "nixpkgs"; 51 52 nixos-facter.url = "github:numtide/nixos-facter-modules"; 53 54 treefmt-nix.url = "github:numtide/treefmt-nix"; 55 treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; 56 57 le_menu.url = "github:lassulus/le_menu"; 58 # le_menu.url = "git+file:/home/lass/src/le_menu"; 59 le_menu.inputs.nixpkgs.follows = "nixpkgs"; 60 61 extra-container.url = "github:erikarvstedt/extra-container"; 62 extra-container.inputs.nixpkgs.follows = "nixpkgs"; 63 }; 64 65 outputs = 66 inputs@{ 67 self, 68 nixpkgs, 69 clan-core, 70 ... 71 }: 72 let 73 clan = clan-core.lib.buildClan { 74 self = self; 75 specialArgs.self = self; 76 modules = import ./clan_modules { inherit nixpkgs; }; 77 inventory = { 78 meta.name = "superconfig"; 79 machines = { 80 ignavia.tags = [ 81 "laptop" 82 "focus" 83 ]; 84 mors.tags = [ 85 "laptop" 86 "focus" 87 ]; 88 aergia.tags = [ 89 "laptop" 90 "focus" 91 ]; 92 barnacle = { 93 machineClass = "darwin"; 94 tags = [ 95 "laptop" 96 "focus" 97 ]; 98 }; 99 icarus.tags = [ "laptop" ]; 100 prism.tags = [ "server" ]; 101 neoprism.tags = [ "server" ]; 102 }; 103 instances = { 104 tor = { 105 roles.server.tags.all = { }; 106 }; 107 internet = { 108 roles.default.machines = { 109 prism.settings.host = "prism.lassul.us"; 110 prism.settings.port = 45621; 111 neoprism.settings.host = "neoprism.lassul.us"; 112 neoprism.settings.port = 45621; 113 }; 114 }; 115 state-version = { 116 module.name = "importer"; 117 roles.default.tags.all = { }; 118 roles.default.settings.extraModules = [ 119 { 120 clan.core.state-version.enable = true; 121 } 122 ]; 123 }; 124 yggdrasil = { 125 roles.default.tags.nixos = { }; 126 }; 127 tor-yggdrasil = { 128 module.name = "tor"; 129 roles.client.tags.all = { }; 130 roles.server.tags.all = { }; 131 roles.server.settings = { 132 secretHostname = false; 133 portMapping = [ 134 { 135 # tcp 136 port = 6443; 137 target.port = 6443; 138 } 139 { 140 # tls 141 port = 6446; 142 target.port = 6443; 143 } 144 ]; 145 }; 146 }; 147 }; 148 }; 149 machines = 150 nixpkgs.lib.mapAttrs 151 (machineName: _: { 152 imports = [ 153 ./machines/${machineName}/physical.nix 154 ]; 155 }) 156 ( 157 nixpkgs.lib.filterAttrs ( 158 machineName: _: builtins.pathExists ./machines/${machineName}/physical.nix 159 ) (builtins.readDir ./machines) 160 ); 161 }; 162 in 163 clan-core.inputs.flake-parts.lib.mkFlake { inherit inputs; } { 164 systems = [ 165 "x86_64-linux" 166 "aarch64-linux" 167 "aarch64-darwin" 168 "x86_64-darwin" 169 ]; 170 imports = [ 171 ./formatter.nix 172 ./5pkgs/flake-module.nix 173 ./keys/flake-module.nix 174 ./wrapperModules/flake-module.nix 175 ./skills/flake-module.nix 176 ./games/flake-module.nix 177 ] 178 ++ ( 179 # Auto-import all flake-module.nix files from tools subdirectories 180 let 181 toolDirs = builtins.attrNames ( 182 nixpkgs.lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./tools) 183 ); 184 in 185 map (dir: ./tools + "/${dir}/flake-module.nix") toolDirs 186 ); 187 flake.nixosConfigurations = clan.nixosConfigurations; 188 flake.clanInternals = clan.clanInternals; 189 flake.darwinConfigurations = clan.darwinConfigurations; 190 flake.clan = clan; 191 192 # Container configurations for use with extra-container 193 # Auto-discovers machines with container.nix 194 flake.containerConfigurations = 195 nixpkgs.lib.mapAttrs 196 (machineName: _: import ./machines/${machineName}/container.nix { inherit self; }) 197 ( 198 nixpkgs.lib.filterAttrs ( 199 machineName: _: builtins.pathExists ./machines/${machineName}/container.nix 200 ) (builtins.readDir ./machines) 201 ); 202 perSystem = 203 { 204 lib, 205 pkgs, 206 system, 207 ... 208 }: 209 { 210 packages = { 211 default = inputs.le_menu.lib.buildMenu { 212 inherit pkgs; 213 menuConfig = { 214 vim.run = "nix run ${self}#nvim"; 215 shell.run = "nix run ${self}#shell"; 216 machines.submenu = lib.mapAttrs (name: _machine: { 217 submenu.ssh.submenu = { 218 retiolum.run = "ssh -t ${name}.r"; 219 spora.run = "ssh ${name}.s"; 220 nether.run = "ssh ${name}.n"; 221 tor.run = "torify ssh $(pass show machines/${name}/tor-hostname)"; 222 }; 223 }) self.nixosConfigurations; 224 debug.run = "env"; 225 }; 226 }; 227 clan-cli = clan-core.packages.${system}.clan-cli; 228 } 229 // lib.mapAttrs' ( 230 name: containerConfig: 231 lib.nameValuePair "container-${name}" ( 232 inputs.extra-container.lib.buildContainers { 233 inherit system; 234 nixpkgs = inputs.nixpkgs; 235 config.containers.${name} = containerConfig; 236 } 237 ) 238 ) self.containerConfigurations; 239 devShells.default = pkgs.mkShell { 240 packages = [ 241 nixpkgs.legacyPackages.${system}.nil 242 nixpkgs.legacyPackages.${system}.nixd 243 self.packages.${pkgs.system}.pass 244 (self.legacyPackages.${system}.bin_shim { 245 name = "clan"; 246 pkg_name = "clan-cli"; 247 }) 248 ]; 249 }; 250 checks = 251 let 252 # Check NixOS configurations can be evaluated (without building) 253 nixosChecks = lib.mapAttrs' ( 254 name: config: 255 lib.nameValuePair "nixos-${name}" ( 256 pkgs.runCommand "eval-${name}" { } '' 257 # Force evaluation of the toplevel path without building 258 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.config.system.build.toplevel.drvPath}" 259 touch $out 260 '' 261 ) 262 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.nixosConfigurations); 263 264 # Check Darwin configurations can be evaluated (without building) 265 darwinChecks = lib.mapAttrs' ( 266 name: config: 267 lib.nameValuePair "darwin-${name}" ( 268 pkgs.runCommand "eval-darwin-${name}" { } '' 269 # Force evaluation of the system path without building 270 echo "Evaluating ${name}: ${builtins.unsafeDiscardStringContext config.system.drvPath}" 271 touch $out 272 '' 273 ) 274 ) (lib.filterAttrs (_: config: config.pkgs.system == system) self.darwinConfigurations); 275 in 276 nixosChecks // darwinChecks; 277 }; 278 flake.lib = import ./lib { inherit (nixpkgs) lib; }; 279 }; 280}