From 2b766df421b359b2d2cd10c32f3fa04611b22999 Mon Sep 17 00:00:00 2001 From: Soispha Date: Fri, 28 Jul 2023 17:57:10 +0200 Subject: Refactor(system/services/nginx): Reduce encrypted stuff to a minimum --- system/services/nginx/default.nix | 40 ++++++++++++++++++++++++++++++++++---- system/services/nginx/hosts.nix | Bin 976 -> 298 bytes 2 files changed, 36 insertions(+), 4 deletions(-) (limited to 'system/services/nginx') 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 Binary files a/system/services/nginx/hosts.nix and b/system/services/nginx/hosts.nix differ -- cgit 1.4.1 From 8350b2ebe1f8da0a54c13a2b1c6e50fc77f2367d Mon Sep 17 00:00:00 2001 From: Soispha Date: Fri, 28 Jul 2023 18:13:31 +0200 Subject: Fix(treewide): Use correct function argument specification --- system/services/mail/users.nix | Bin 1136 -> 1138 bytes system/services/nginx/hosts.nix | Bin 298 -> 300 bytes 2 files changed, 0 insertions(+), 0 deletions(-) (limited to 'system/services/nginx') diff --git a/system/services/mail/users.nix b/system/services/mail/users.nix index 0b8952a..a30d547 100644 Binary files a/system/services/mail/users.nix and b/system/services/mail/users.nix differ diff --git a/system/services/nginx/hosts.nix b/system/services/nginx/hosts.nix index b209b69..3abd841 100644 Binary files a/system/services/nginx/hosts.nix and b/system/services/nginx/hosts.nix differ -- cgit 1.4.1 From 81bf11240f8a254fe311c72d96adbcacb12d124b Mon Sep 17 00:00:00 2001 From: Soispha Date: Mon, 31 Jul 2023 18:16:29 +0200 Subject: Feat(system/services/nginx/hosts): Add another domain --- system/services/nginx/hosts.nix | Bin 300 -> 454 bytes 1 file changed, 0 insertions(+), 0 deletions(-) (limited to 'system/services/nginx') diff --git a/system/services/nginx/hosts.nix b/system/services/nginx/hosts.nix index 3abd841..550c28f 100644 Binary files a/system/services/nginx/hosts.nix and b/system/services/nginx/hosts.nix differ -- cgit 1.4.1 From 2aa1c1641161185edd31df73739b26dea56b3786 Mon Sep 17 00:00:00 2001 From: Soispha Date: Fri, 18 Aug 2023 20:43:59 +0200 Subject: Fix(system/services/nginx): Update hosts --- system/services/nginx/hosts.nix | Bin 454 -> 300 bytes 1 file changed, 0 insertions(+), 0 deletions(-) (limited to 'system/services/nginx') diff --git a/system/services/nginx/hosts.nix b/system/services/nginx/hosts.nix index 550c28f..3abd841 100644 Binary files a/system/services/nginx/hosts.nix and b/system/services/nginx/hosts.nix differ -- cgit 1.4.1