diff options
author | sils <sils@sils.li> | 2023-10-14 15:28:05 +0200 |
---|---|---|
committer | sils <sils@sils.li> | 2023-10-14 15:28:05 +0200 |
commit | 04e4866a17853d583c943b52ec2b9c5e7518e4ae (patch) | |
tree | bd079002dbebd4fffc533596c3f4e5a99a6b3a56 /system/services/nginx | |
parent | Fix(system/services/etebase): Add proxy parameters (diff) | |
parent | fix(system/services/mastodon): Correctly avoid string casts (diff) | |
download | nixos-server-04e4866a17853d583c943b52ec2b9c5e7518e4ae.tar.gz nixos-server-04e4866a17853d583c943b52ec2b9c5e7518e4ae.zip |
Merge branch 'main' into etebase
Diffstat (limited to 'system/services/nginx')
-rw-r--r-- | system/services/nginx/default.nix | 40 | ||||
-rw-r--r-- | system/services/nginx/hosts.nix | bin | 976 -> 300 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..3abd841 100644 --- a/system/services/nginx/hosts.nix +++ b/system/services/nginx/hosts.nix Binary files differ |