summary refs log tree commit diff
path: root/host/Spacebar-nginx/containers/spacebar-server-dev-nix/import.nix
diff options
context:
space:
mode:
Diffstat (limited to 'host/Spacebar-nginx/containers/spacebar-server-dev-nix/import.nix')
-rw-r--r--host/Spacebar-nginx/containers/spacebar-server-dev-nix/import.nix71
1 files changed, 40 insertions, 31 deletions
diff --git a/host/Spacebar-nginx/containers/spacebar-server-dev-nix/import.nix b/host/Spacebar-nginx/containers/spacebar-server-dev-nix/import.nix
index 5daacfb..7cc8763 100644
--- a/host/Spacebar-nginx/containers/spacebar-server-dev-nix/import.nix
+++ b/host/Spacebar-nginx/containers/spacebar-server-dev-nix/import.nix
@@ -1,41 +1,50 @@
-{ config, pkgs, lib, spacebar-server, secrets, ... }:
+{ 
+  config,
+  pkgs,
+  lib,
+  secrets,
+  spacebar-server,
+  containerName,
+  rootDomain,
+  ...
+}:
 
 {
-    containers."spacebarchat-server-dev-nix" = import ./container.nix {
-      inherit pkgs lib spacebar-server;
-    };
+  containers."${containerName}" = import ./container.nix {
+    inherit pkgs lib spacebar-server;
+  };
 
-    security.acme.certs."dev-nix.server.spacebar.chat" = {
-      domain = "dev-nix.server.spacebar.chat";
-      extraDomainNames = [ "*.dev-nix.server.spacebar.chat" ];
-      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}
-        '';
-      };
+  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."*.dev-nix.server.spacebar.chat" = {
-      serverName = "*.dev-nix.server.spacebar.chat";
-      useACMEHost = "dev-nix.server.spacebar.chat";
-      forceSSL = true;
-      locations."/" = {
-        proxyPass = "http://192.168.100.1";
-      };
+  services.nginx.virtualHosts."*.${rootDomain}" = {
+    serverName = "*.${rootDomain}";
+    useACMEHost = "${rootDomain}";
+    forceSSL = true;
+    locations."/" = {
+      proxyPass = "http://${containerName}.containers";
     };
-    services.nginx.virtualHosts."dev-nix.server.spacebar.chat" = {
-      serverName = "dev-nix.server.spacebar.chat";
-      useACMEHost = "dev-nix.server.spacebar.chat";
-      forceSSL = true;
-      locations."/" = {
-        proxyPass = "http://192.168.100.1";
-      };
+  };
+  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