{ config, lib, pkgs, ... }: let shortdomain = "i4f.de"; short = name: target: { inherit name target; }; toVirtualHosts = {name, target, ...}: { name = "${name}.${shortdomain}"; value = { forceSSL = true; enableACME = true; locations."/".return = "302 https://${target}$request_uri"; }; }; redirects = [ (short "d" "discuss.infra4future.de") (short "m" "mattermost.infra4future.de") (short "c" "cloud.infra4future.de") (short "s" "survey.infra4future.de") (short "g" "gitlab.infra4future.de") ]; in { services.nginx.virtualHosts = lib.listToAttrs (map toVirtualHosts redirects) // { ${shortdomain} = { enableACME = true; forceSSL = true; root = pkgs.writeText "index.html" ''