summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xflake.nix8
-rwxr-xr-xhost/Spacebar-nginx/configuration.nix10
-rwxr-xr-xhost/Spacebar-nginx/containers/spacebar-server-dev-nix/container.nix4
-rw-r--r--host/Spacebar-nginx/containers/spacebar-server-dev-nix/import.nix2
-rwxr-xr-xhost/Spacebar-nginx/containers/spacebar-server-dev-nix/services/nginx.nix19
-rwxr-xr-xhost/Spacebar-nginx/containers/spacebar-server-dev-nix/services/spacebar-server.nix72
6 files changed, 58 insertions, 57 deletions
diff --git a/flake.nix b/flake.nix
index d7813cc..b9c36ee 100755
--- a/flake.nix
+++ b/flake.nix
@@ -13,12 +13,14 @@
       flake = false;
     };
 
-    spacebarchat-server-dev-nix.url = "github:spacebarchat/server/dev/nix";
+    spacebarchat-server-master = {
+      url = "github:spacebarchat/server/master";
+    };
 
     #moreinputs
   };
 
-  outputs = { self, nixpkgs, home-manager, secrets, spacebarchat-server-dev-nix }: {
+  outputs = { self, nixpkgs, home-manager, secrets, spacebarchat-server-master }: {
     nixosConfigurations = {
       Spacebar-nginx = nixpkgs.lib.nixosSystem {
         system = "x86_64-linux";
@@ -29,7 +31,7 @@
         ];
         specialArgs = {
           inherit home-manager;
-          inherit spacebarchat-server-dev-nix;
+          inherit spacebarchat-server-master;
           #morespecialargs
           secrets = import secrets { inherit (nixpkgs) lib; };
         };
diff --git a/host/Spacebar-nginx/configuration.nix b/host/Spacebar-nginx/configuration.nix
index 15c8ffc..8148c3c 100755
--- a/host/Spacebar-nginx/configuration.nix
+++ b/host/Spacebar-nginx/configuration.nix
@@ -1,14 +1,14 @@
-{ config, pkgs, lib, secrets, spacebarchat-server-dev-nix, ... }:
+{ config, pkgs, lib, secrets, spacebarchat-server-master, ... }:
 
 {
   imports =
     [
       ../../modules/base.nix
-      (import ./containers/spacebar-server-dev-nix/import.nix { 
+      (import ./containers/spacebar-server/import.nix { 
         inherit config lib pkgs secrets;
-        spacebar-server = spacebarchat-server-dev-nix;
-        containerName = "spacebar-server-dev-nix";
-        rootDomain = "dev-nix.server.spacebar.chat";
+        spacebar-server = spacebarchat-server-master;
+        containerName = "spacebar-server-master";
+        rootDomain = "master.server.spacebar.chat";
       })
     ];
 
diff --git a/host/Spacebar-nginx/containers/spacebar-server-dev-nix/container.nix b/host/Spacebar-nginx/containers/spacebar-server-dev-nix/container.nix
index 277a556..12dd2cc 100755
--- a/host/Spacebar-nginx/containers/spacebar-server-dev-nix/container.nix
+++ b/host/Spacebar-nginx/containers/spacebar-server-dev-nix/container.nix
@@ -6,8 +6,8 @@
   specialArgs = {
     inherit spacebar-server;
   };  
-  config = { lib, pkgs, spacebar-server, ... }: {
-    imports = [ ./root.nix ];
+  config = { lib, pkgs, spacebar-server, rootDomain, ... }: {
+    imports = [ (import ./root.nix { inherit lib pkgs spacebar-server rootDomain; }) ];
     environment.etc."resolv.conf".text = ''
       nameserver 8.8.8.8
       nameserver 8.4.4.8
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 7cc8763..7be8e2d 100644
--- a/host/Spacebar-nginx/containers/spacebar-server-dev-nix/import.nix
+++ b/host/Spacebar-nginx/containers/spacebar-server-dev-nix/import.nix
@@ -11,7 +11,7 @@
 
 {
   containers."${containerName}" = import ./container.nix {
-    inherit pkgs lib spacebar-server;
+    inherit pkgs lib spacebar-server rootDomain;
   };
 
   security.acme.certs."${rootDomain}" = {
diff --git a/host/Spacebar-nginx/containers/spacebar-server-dev-nix/services/nginx.nix b/host/Spacebar-nginx/containers/spacebar-server-dev-nix/services/nginx.nix
index 9cb8d92..675e861 100755
--- a/host/Spacebar-nginx/containers/spacebar-server-dev-nix/services/nginx.nix
+++ b/host/Spacebar-nginx/containers/spacebar-server-dev-nix/services/nginx.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, lib, spacebar-server, ... }:
+{ config, pkgs, lib, spacebar-server, rootDomain ... }:
 
 {
   services = {
@@ -25,18 +25,18 @@
         moreheaders
       ];
       virtualHosts = {
-        "dev-nix.server.spacebar.chat" = {
+        "${rootDomain}" = {
           locations."= /.well-known/spacebarchat/client".extraConfig = ''
             more_set_headers 'Content-Type application/json';
             more_set_headers 'Access-Control-Allow-Origin *';
             return 200 '${builtins.toJSON {
-              cdn = "cdn.dev-nix.server.spacebar.chat";
-              gateway = "gateway.dev-nix.server.spacebar.chat";
-              api = "api.dev-nix.server.spacebar.chat";
+              cdn = "cdn.${rootDomain}";
+              gateway = "gateway.${rootDomain}";
+              api = "api.${rootDomain}";
             }}';
           '';
         };
-        "api.dev-nix.server.spacebar.chat" = {
+        "api.${rootDomain}" = {
           locations."/" = {
             proxyPass = "http://127.0.0.1:3001"; 
             extraConfig = ''
@@ -58,7 +58,7 @@
             '';
           };
         };
-        "cdn.dev-nix.server.spacebar.chat" = {
+        "cdn.${rootDomain}" = {
           locations."/" = {
             proxyPass = "http://127.0.0.1:3003"; 
             extraConfig = ''
@@ -80,7 +80,7 @@
             '';
           };
         };
-        "gateway.dev-nix.server.spacebar.chat" = {
+        "gateway.${rootDomain}" = {
           locations."/" = {
             proxyPass = "http://127.0.0.1:3002"; 
             extraConfig = ''
@@ -105,11 +105,10 @@
       };
     };
   };
+  
   systemd.services.nginx.serviceConfig = {
     LimitNOFILE=5000000;
   };
-  security.acme.acceptTerms = true;
-  security.acme.defaults.email = "root@rory.gay";
 
   system.stateVersion = "22.11"; # DO NOT EDIT!
 }
diff --git a/host/Spacebar-nginx/containers/spacebar-server-dev-nix/services/spacebar-server.nix b/host/Spacebar-nginx/containers/spacebar-server-dev-nix/services/spacebar-server.nix
index 1debbbd..aaa1396 100755
--- a/host/Spacebar-nginx/containers/spacebar-server-dev-nix/services/spacebar-server.nix
+++ b/host/Spacebar-nginx/containers/spacebar-server-dev-nix/services/spacebar-server.nix
@@ -21,52 +21,52 @@
         wantedBy = [ "multi-user.target" ];
         after = [ "resolvconf.target" "postgresql.service" "rabbitmq.service" ];
         serviceConfig = {
-            ExecStart = ''
-              ${spacebar-server.packages.${pkgs.system}.default}/bin/start-api
-              '';
-            #Restart = "never";
-            User = "spacebar";
-            WorkingDirectory = "/var/lib/spacebar-server";
-            Environment = [
-              "DATABASE=postgres://spacebar:spacebar@127.0.0.1/spacebar"
-              "LOG_REQUESTS='-'"
-              #"DB_LOGGING='true'"
-            ];
-        };
+          ExecStart = ''
+            ${spacebar-server.packages.${pkgs.system}.default}/bin/start-api
+            '';
+          #Restart = "never";
+          User = "spacebar";
+          WorkingDirectory = "/var/lib/spacebar-server";
+          Environment = [
+            "DATABASE=postgres://spacebar:spacebar@127.0.0.1/spacebar"
+            "LOG_REQUESTS='-'"
+            #"DB_LOGGING='true'"
+          ];
+      };
     };
     "spacebar-server-gateway" = {
         wantedBy = [ "multi-user.target" ];
         after = [ "resolvconf.target" "postgresql.service" "rabbitmq.service" "spacebar-server-api.service" ];
         serviceConfig = {
-            ExecStart = ''
-              ${spacebar-server.packages.${pkgs.system}.default}/bin/start-gateway
-              '';
-            #Restart = "never";
-            User = "spacebar";
-            WorkingDirectory = "/var/lib/spacebar-server";
-            Environment = [
-              "DATABASE=postgres://spacebar:spacebar@127.0.0.1/spacebar"
-              "LOG_REQUESTS='-'"
-              #"DB_LOGGING='true'"
-            ];
-        };
+          ExecStart = ''
+            ${spacebar-server.packages.${pkgs.system}.default}/bin/start-gateway
+            '';
+          #Restart = "never";
+          User = "spacebar";
+          WorkingDirectory = "/var/lib/spacebar-server";
+          Environment = [
+            "DATABASE=postgres://spacebar:spacebar@127.0.0.1/spacebar"
+            "LOG_REQUESTS='-'"
+            #"DB_LOGGING='true'"
+          ];
+      };
     };
     "spacebar-server-cdn" = {
         wantedBy = [ "multi-user.target" ];
         after = [ "resolvconf.target" "postgresql.service" "rabbitmq.service" "spacebar-server-api.service" ];
         serviceConfig = {
-            ExecStart = ''
-              ${spacebar-server.packages.${pkgs.system}.default}/bin/start-cdn
-              '';
-            #Restart = "never";
-            User = "spacebar";
-            WorkingDirectory = "/var/lib/spacebar-server";
-            Environment = [
-              "DATABASE=postgres://spacebar:spacebar@127.0.0.1/spacebar"
-              "LOG_REQUESTS='-'"
-              #"DB_LOGGING='true'"
-            ];
-        };
+          ExecStart = ''
+            ${spacebar-server.packages.${pkgs.system}.default}/bin/start-cdn
+            '';
+          #Restart = "never";
+          User = "spacebar";
+          WorkingDirectory = "/var/lib/spacebar-server";
+          Environment = [
+            "DATABASE=postgres://spacebar:spacebar@127.0.0.1/spacebar"
+            "LOG_REQUESTS='-'"
+            #"DB_LOGGING='true'"
+          ];
+      };
     };
   };