This repository has no description
0

Configure Feed

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

superconfig / flake.nix
9.9 kB 287 lines
1{ 2 description = "lassulus superconfig"; 3 4 inputs = { 5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 6 # nixpkgs.url = "path:/home/lass/tmp/nixpkgs-disk-debug"; 7 # nixpkgs.url = "git+file:/home/lass/src/nixpkgs"; 8 9 flake-parts.url = "github:hercules-ci/flake-parts"; 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 = "git+file:/home/lass/src/clan/clan-core"; 20 clan-core.inputs.nixpkgs.follows = "nixpkgs"; 21 clan-core.inputs.flake-parts.follows = "flake-parts"; 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 62 outputs = 63 inputs@{ 64 self, 65 flake-parts, 66 nixpkgs, 67 clan-core, 68 ... 69 }: 70 let 71 clan = clan-core.lib.buildClan { 72 self = self; 73 specialArgs.self = self; 74 exportsModule = 75 { lib, ... }: 76 { 77 options.networking = { 78 priority = lib.mkOption { 79 type = lib.types.int; 80 default = 1000; 81 description = '' 82 priority with which this network should be tried. 83 higher priority means it gets used earlier in the chain 84 ''; 85 }; 86 technology = lib.mkOption { 87 # addding more technologies requires code in the clan-cli to handle that technology 88 # at least for userspace networking 89 # maybe we can do a fallback mode for vpns where we don't need userspace networking? 90 type = lib.types.enum [ 91 "direct" 92 "tor" 93 ]; 94 description = '' 95 the technology this network uses to connect to the target 96 This is used for userspace networking with socks proxies. 97 ''; 98 }; 99 # should we call this machines? hosts? 100 peers = lib.mkOption { 101 # <name> 102 type = lib.types.attrsOf ( 103 lib.types.submodule ( 104 { name, ... }: 105 { 106 options = { 107 name = lib.mkOption { 108 type = lib.types.str; 109 default = name; 110 }; 111 SSHOptions = lib.mkOption { 112 type = lib.types.listOf lib.types.str; 113 default = [ ]; 114 }; 115 host = lib.mkOption { 116 description = ''''; 117 type = lib.types.attrTag { 118 plain = lib.mkOption { 119 type = lib.types.str; 120 description = '' 121 a plain value, which can be read directly from the config 122 ''; 123 }; 124 var = lib.mkOption { 125 type = lib.types.submodule { 126 options = { 127 machine = lib.mkOption { 128 type = lib.types.str; 129 example = "jon"; 130 }; 131 generator = lib.mkOption { 132 type = lib.types.str; 133 example = "tor-ssh"; 134 }; 135 file = lib.mkOption { 136 type = lib.types.str; 137 example = "hostname"; 138 }; 139 }; 140 }; 141 }; 142 }; 143 }; 144 }; 145 } 146 ) 147 ); 148 }; 149 }; 150 }; 151 modules = import ./clan_modules { inherit nixpkgs; }; 152 inventory = { 153 meta.name = "superconfig"; 154 machines = { 155 ignavia.tags = [ 156 "laptop" 157 "focus" 158 ]; 159 mors.tags = [ 160 "laptop" 161 "focus" 162 ]; 163 aergia.tags = [ 164 "laptop" 165 "focus" 166 ]; 167 barnacle = { 168 machineClass = "darwin"; 169 tags = [ 170 "laptop" 171 "focus" 172 ]; 173 }; 174 icarus.tags = [ "laptop" ]; 175 prism.tags = [ "server" ]; 176 neoprism.tags = [ "server" ]; 177 }; 178 instances = { 179 tor = { 180 module.name = "tor"; 181 module.input = "self"; 182 roles.default.tags.all = { }; 183 }; 184 internet = { 185 module.name = "internet"; 186 module.input = "self"; 187 roles.default.machines = { 188 prism.settings.host = "prism.lassul.us"; 189 neoprism.settings.host = "neoprism.lassul.us"; 190 }; 191 }; 192 state-version = { 193 module.name = "importer"; 194 roles.default.tags.all = { }; 195 roles.default.settings.extraModules = [ 196 { 197 clan.core.state-version.enable = true; 198 } 199 ]; 200 }; 201 }; 202 }; 203 machines = 204 nixpkgs.lib.mapAttrs 205 (machineName: _: { 206 imports = [ 207 ./machines/${machineName}/physical.nix 208 ]; 209 }) 210 ( 211 nixpkgs.lib.filterAttrs ( 212 machineName: _: builtins.pathExists ./machines/${machineName}/physical.nix 213 ) (builtins.readDir ./machines) 214 ); 215 }; 216 in 217 flake-parts.lib.mkFlake { inherit inputs; } { 218 systems = [ 219 "x86_64-linux" 220 "aarch64-linux" 221 "aarch64-darwin" 222 "x86_64-darwin" 223 ]; 224 imports = 225 [ 226 ./formatter.nix 227 ./5pkgs/flake-module.nix 228 ./keys/flake-module.nix 229 ] 230 ++ ( 231 # Auto-import all flake-module.nix files from tools subdirectories 232 let 233 toolDirs = builtins.attrNames ( 234 nixpkgs.lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./tools) 235 ); 236 in 237 map (dir: ./tools + "/${dir}/flake-module.nix") toolDirs 238 ); 239 flake.nixosConfigurations = clan.nixosConfigurations; 240 flake.clanInternals = clan.clanInternals; 241 flake.darwinConfigurations = clan.darwinConfigurations; 242 flake.clan = clan; 243 perSystem = 244 { 245 lib, 246 pkgs, 247 system, 248 ... 249 }: 250 { 251 packages = { 252 default = inputs.le_menu.lib.buildMenu { 253 inherit pkgs; 254 menuConfig = { 255 vim.run = "nix run ${self}#nvim"; 256 shell.run = "nix run ${self}#shell"; 257 machines.submenu = lib.mapAttrs (name: _machine: { 258 submenu.ssh.submenu = { 259 retiolum.run = "ssh -t ${name}.r"; 260 spora.run = "ssh ${name}.s"; 261 nether.run = "ssh ${name}.n"; 262 tor.run = "torify ssh $(pass show machines/${name}/tor-hostname)"; 263 }; 264 }) self.nixosConfigurations; 265 debug.run = "env"; 266 }; 267 }; 268 clan-cli = clan-core.packages.${system}.clan-cli; 269 }; 270 devShells.default = pkgs.mkShell { 271 packages = [ 272 clan-core.packages.${system}.clan-cli 273 nixpkgs.legacyPackages.${system}.nil 274 nixpkgs.legacyPackages.${system}.nixd 275 ]; 276 }; 277 }; 278 flake.lib = import ./lib { inherit (nixpkgs) lib; }; 279 flake.libWithPkgs = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed ( 280 system: 281 import ./lib/pkgs.nix { 282 inherit (nixpkgs) lib; 283 pkgs = nixpkgs.legacyPackages.${system}; 284 } 285 ); 286 }; 287}