diff options
author | Rory& <root@rory.gay> | 2024-02-19 11:18:45 +0100 |
---|---|---|
committer | Rory& <root@rory.gay> | 2024-06-05 17:25:16 +0200 |
commit | 7720ba2a8c17e31ea303e5b5c72bf8239d65c6c0 (patch) | |
tree | 3b7c1094a10b7dd8b3562debd8c9c72cf0d8cfd8 /host/Spacebar-nginx/containers/spacebar-server/import.nix | |
parent | Switch dev/nix instance to master (diff) | |
download | Spacebar-Open-Infrastructure-7720ba2a8c17e31ea303e5b5c72bf8239d65c6c0.tar.xz |
Fix container folder name
Diffstat (limited to 'host/Spacebar-nginx/containers/spacebar-server/import.nix')
-rw-r--r-- | host/Spacebar-nginx/containers/spacebar-server/import.nix | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/host/Spacebar-nginx/containers/spacebar-server/import.nix b/host/Spacebar-nginx/containers/spacebar-server/import.nix new file mode 100644 index 0000000..7be8e2d --- /dev/null +++ b/host/Spacebar-nginx/containers/spacebar-server/import.nix @@ -0,0 +1,50 @@ +{ + config, + pkgs, + lib, + secrets, + spacebar-server, + containerName, + rootDomain, + ... +}: + +{ + containers."${containerName}" = import ./container.nix { + inherit pkgs lib spacebar-server rootDomain; + }; + + security.acme.certs."${rootDomain}" = { + domain = "${rootDomain}"; + extraDomainNames = [ "*.${rootDomain}" ]; + group = "nginx"; + dnsProvider = "cloudflare"; + credentialsFile = pkgs.writeTextFile { + name = "cloudflare-credentials"; + text = '' + # Cloudflare API credentials used by lego + # https://go-acme.github.io/lego/dns/cloudflare/ + CLOUDFLARE_DNS_API_TOKEN=${secrets.secret_keys.cloudflare_dns} + ''; + }; + }; + + services.nginx.virtualHosts."*.${rootDomain}" = { + serverName = "*.${rootDomain}"; + useACMEHost = "${rootDomain}"; + forceSSL = true; + locations."/" = { + proxyPass = "http://${containerName}.containers"; + }; + }; + services.nginx.virtualHosts."${rootDomain}" = { + serverName = "${rootDomain}"; + useACMEHost = "${rootDomain}"; + forceSSL = true; + locations."/" = { + proxyPass = "http://${containerName}.containers"; + }; + }; + + system.stateVersion = "22.11"; # DO NOT EDIT! +} \ No newline at end of file |