{ flakes, pkgs, ... }: let cache = pkg: '' location ~* \.(png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf)$ { expires max; add_header Cache-Control "public, no-transform"; root ${pkg}; } ''; regular = "${flakes.homepage.packages.${pkgs.system}.website}"; gay = "${flakes.homepage.packages.${pkgs.system}.website-gay}"; ssl = { forceSSL = true; http2 = true; enableACME = true; }; base = pkg: { extraConfig = cache pkg; } // ssl; site = pkg: { locations."/".root = pkg; } // (base pkg); redirect = return: { locations."/".return = return; } // ssl; in { services.nginx = { virtualHosts = { "donsz.nl" = site regular; "jdonszelmann.nl" = site regular; "blog.donsz.nl" = redirect "301 https://donsz.nl/blog"; "gay.donsz.nl" = site gay; "jana.is.fckn.gay" = site gay; }; }; }