My Nix Configuration
2
fork

Configure Feed

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

[prefect] refactor a lot of the caddy config generation

dish 98d91035 61d4074a

+80 -93
+29 -92
hosts/prefect/services/caddy.nix
··· 1 1 { pkgs, self, ... }: 2 2 let 3 3 pns = self.lib.data.services; 4 - inherit (self.lib.data) mail; 5 4 marvin = "http://${self.lib.data.hosts.marvin.ts.ip4}"; 6 5 marvinIP = self.lib.data.hosts.marvin.ts.ip4; 7 - inherit (self.lib.data) tsNet; 6 + 7 + anubisHosts = self.lib.caddy.mkAnubisSites [ 8 + # keep-sorted start 9 + "git" 10 + "grafana" 11 + "miniflux" 12 + "nextcloud" 13 + "planka" 14 + # keep-sorted end 15 + ]; 16 + 17 + tsHosts = self.lib.caddy.mkTsSites [ 18 + # keep-sorted start 19 + "shelfmark" 20 + "pinchflat" 21 + # keep-sorted end 22 + ]; 23 + 24 + directHosts = self.lib.caddy.mkDirectSites [ 25 + # keep-sorted start 26 + "booklore" 27 + "tangled-knot" 28 + "tangled-spindle" 29 + # keep-sorted end 30 + ]; 8 31 in 9 32 { 10 33 services.caddy = { ··· 150 173 }; 151 174 # SIMPLE HOSTS 152 175 153 - # Forgejo 154 - ${pns.git.extUrl} = { 155 - extraConfig = '' 156 - reverse_proxy ${marvin}:${toString pns.git.anubis} { 157 - header_up X-Real-Ip {remote_host} 158 - header_up X-Http-Version {http.request.proto} 159 - } 160 - ''; 161 - }; 162 - 163 - # Grafana 164 - ${pns.grafana.extUrl} = { 165 - extraConfig = '' 166 - reverse_proxy ${marvin}:${toString pns.grafana.anubis} { 167 - header_up X-Real-Ip {remote_host} 168 - header_up X-Http-Version {http.request.proto} 169 - } 170 - ''; 171 - }; 172 - 173 - # Miniflux 174 - ${pns.miniflux.extUrl} = { 175 - extraConfig = '' 176 - reverse_proxy ${marvin}:${toString pns.miniflux.anubis} { 177 - header_up X-Real-Ip {remote_host} 178 - header_up X-Http-Version {http.request.proto} 179 - } 180 - ''; 181 - }; 182 - 183 - # Nextcloud 184 - ${pns.nextcloud.extUrl} = { 185 - extraConfig = '' 186 - reverse_proxy ${marvin}:${toString pns.nextcloud.anubis} { 187 - header_up X-Real-Ip {remote_host} 188 - header_up X-Http-Version {http.request.proto} 189 - } 190 - ''; 191 - }; 192 - 193 - # Planka 194 - ${pns.planka.extUrl} = { 195 - extraConfig = '' 196 - reverse_proxy ${marvin}:${toString pns.planka.anubis} { 197 - header_up X-Real-Ip {remote_host} 198 - header_up X-Http-Version {http.request.proto} 199 - } 200 - ''; 201 - }; 202 - 203 176 # Paperless-NGX 204 177 ${pns.paperless.extUrl} = { 205 178 extraConfig = '' ··· 224 197 reverse_proxy ${marvin}:${toString pns.immich.port} 225 198 ''; 226 199 }; 227 - 228 - # Booklore 229 - ${pns.booklore.extUrl} = { 230 - extraConfig = '' 231 - reverse_proxy ${marvin}:${toString pns.booklore.port} 232 - ''; 233 - }; 234 - 235 - # Tangled Services 236 - ${pns.tangled-knot.extUrl} = { 237 - extraConfig = '' 238 - reverse_proxy ${marvin}:${toString pns.tangled-knot.port} 239 - ''; 240 - }; 241 - ${pns.tangled-spindle.extUrl} = { 242 - extraConfig = '' 243 - reverse_proxy ${marvin}:${toString pns.tangled-spindle.port} 244 - ''; 245 - }; 246 - 247 - # Simple Tailscale Hosts 248 - 249 - # Pinchflat 250 - "${pns.pinchflat.tsHost}.${tsNet}" = { 251 - extraConfig = '' 252 - bind tailscale/${pns.pinchflat.tsHost} 253 - tailscale_auth 254 - reverse_proxy ${marvin}:${toString pns.pinchflat.port} 255 - ''; 256 - }; 257 - 258 - # Shelfmark 259 - "${pns.shelfmark.tsHost}.${tsNet}" = { 260 - extraConfig = '' 261 - bind tailscale/${pns.shelfmark.tsHost} 262 - tailscale_auth 263 - reverse_proxy ${marvin}:${toString pns.shelfmark.port} 264 - ''; 265 - }; 266 - }; 200 + } 201 + // anubisHosts 202 + // tsHosts 203 + // directHosts; 267 204 # Blog/SSH Config 268 205 globalConfig = '' 269 206 filesystem blog-repo git ${marvin}:${toString pns.git.port}/pyrox/new-blog {
+47
lib/caddy.nix
··· 1 + { lib, self, ... }: 2 + let 3 + 4 + pns = self.lib.data.services; 5 + marvinIP = self.lib.data.hosts.marvin.ts.ip4; 6 + marvin = "http://${marvinIP}"; 7 + inherit (self.lib.data) tsNet; 8 + 9 + in 10 + rec { 11 + mkHosts = function: services: lib.listToAttrs (map function services); 12 + 13 + mkAnubis = 14 + service: 15 + lib.nameValuePair "${pns.${service}.extUrl}" { 16 + extraConfig = '' 17 + reverse_proxy ${marvin}:${toString pns.${service}.anubis} { 18 + header_up X-Real-Ip {remote_host} 19 + header_up X-Http-Version {http.request.proto} 20 + } 21 + ''; 22 + }; 23 + 24 + mkAnubisSites = services: mkHosts mkAnubis services; 25 + 26 + mkTs = 27 + service: 28 + lib.nameValuePair "${pns.${service}.tsHost}.${tsNet}" { 29 + extraConfig = '' 30 + bind tailscale/${pns.${service}.tsHost} 31 + tailscale_auth 32 + reverse_proxy ${marvin}:${toString pns.${service}.port} 33 + ''; 34 + }; 35 + 36 + mkTsSites = services: mkHosts mkTs services; 37 + 38 + mkDirect = 39 + service: 40 + lib.nameValuePair "${pns.${service}.extUrl}" { 41 + extraConfig = '' 42 + reverse_proxy ${marvin}:${toString pns.${service}.port} 43 + ''; 44 + }; 45 + 46 + mkDirectSites = services: mkHosts mkDirect services; 47 + }
+4 -1
lib/default.nix
··· 1 1 _: { 2 2 flake = { 3 - lib.data = import ./data; 3 + lib = { 4 + caddy = import ./caddy.nix; 5 + data = import ./data; 6 + }; 4 7 }; 5 8 }