This repository has no description
0

Configure Feed

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

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