aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-07-28 17:57:10 +0200
committerSoispha <soispha@vhack.eu>2023-07-28 18:02:03 +0200
commit2b766df421b359b2d2cd10c32f3fa04611b22999 (patch)
treef7a003bcfe2a8024c2404c2620b84ff46f49bc23
parentchore(version): v0.5.1 (diff)
downloadnixos-server-2b766df421b359b2d2cd10c32f3fa04611b22999.zip
Refactor(system/services/nginx): Reduce encrypted stuff to a minimum
-rw-r--r--system/services/nginx/default.nix40
-rw-r--r--system/services/nginx/hosts.nixbin976 -> 298 bytes
2 files changed, 36 insertions, 4 deletions
diff --git a/system/services/nginx/default.nix b/system/services/nginx/default.nix
index 404c167..8544475 100644
--- a/system/services/nginx/default.nix
+++ b/system/services/nginx/default.nix
@@ -1,7 +1,33 @@
-{...}: {
- imports = [
- ./hosts.nix
- ];
+{...}: let
+ domains = import ./hosts.nix {};
+ mkVirtHost = {
+ domain,
+ root,
+ url,
+ }: {
+ name = "${domain}";
+ value = {
+ forceSSL = true;
+ enableACME = true;
+ root = "${root}";
+ };
+ };
+
+ mkNixSyncRepository = {
+ domain,
+ root,
+ url,
+ }: {
+ name = "${domain}";
+ value = {
+ path = "${root}";
+ uri = "${url}";
+ };
+ };
+
+ virtHosts = builtins.listToAttrs (builtins.map mkVirtHost domains);
+ nixSyncRepositories = builtins.listToAttrs (builtins.map mkNixSyncRepository domains);
+in {
security.acme = {
acceptTerms = true;
defaults = {
@@ -15,5 +41,11 @@
};
services.nginx = {
enable = true;
+ virtualHosts = virtHosts;
+ };
+
+ services.nix-sync = {
+ enable = true;
+ repositories = nixSyncRepositories;
};
}
diff --git a/system/services/nginx/hosts.nix b/system/services/nginx/hosts.nix
index 1590756..b209b69 100644
--- a/system/services/nginx/hosts.nix
+++ b/system/services/nginx/hosts.nix
Binary files differ