This repository has no description
0

Configure Feed

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

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