forked from hacc/haccfiles
stuebinm
eb07f34672
idea is to have a directory `websites/` which contains all our static sites, with the name of each subdirectory also being their domain. Then Nix can just read that directory during build-time and automatically generate nginx virtualHosts for all of them (note that the subdirectories have to contain a `default.nix` specifying how to build the site for that to work). Thus we could avoid the dependency on gitlab pages.
45 lines
1.3 KiB
Nix
45 lines
1.3 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
let
|
|
domains = [ "www.infra4future.de" "hacc.earth" "www.hacc.earth" "muc.hacc.earth" "help.studentsforfuture.info" ];
|
|
in {
|
|
hacc.websites = {
|
|
enable = true;
|
|
directory = ../websites;
|
|
};
|
|
|
|
services.nginx.virtualHosts =
|
|
listToAttrs (map (host: nameValuePair host {
|
|
useACMEHost = "infra4future.de";
|
|
forceSSL = true;
|
|
locations."/".proxyPass = "http://${config.containers.gitlab.localAddress}:8090";
|
|
}) domains) // {
|
|
"infra4future.de" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
locations."/".proxyPass = "http://${config.containers.gitlab.localAddress}:8090";
|
|
};
|
|
"muc.hacc.earth" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
locations."/".extraConfig = ''
|
|
proxy_pass "http://${config.containers.gitlab.localAddress}:8090/infra4future/muc.hacc.earth/";
|
|
proxy_set_header Host 'hacc.4future.dev';
|
|
'';
|
|
};
|
|
"help.studentsforfuture.info" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
locations."/".extraConfig = ''
|
|
proxy_pass "http://${config.containers.gitlab.localAddress}:8090/pcs-docs/";
|
|
proxy_set_header Host 'studentsforfuture.4future.dev';
|
|
'';
|
|
};
|
|
};
|
|
|
|
security.acme.certs."infra4future.de" = {
|
|
extraDomainNames = domains;
|
|
};
|
|
}
|