summaryrefslogtreecommitdiff
path: root/sys/web/sites
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2025-08-24 18:55:06 -0600
committerAlejandro Soto <alejandro@34project.org>2025-08-24 18:55:06 -0600
commitd7ac88762db111a7962c4e14b5f4e37ab85ccac7 (patch)
tree0c2c8c4383bef74215e3b7c48a2f6b0117f084bc /sys/web/sites
parent504589d1035f27b766bd33040b415b2725ece4ca (diff)
tree-wide: reformat using alejandra after enabling trivionomicon
Diffstat (limited to 'sys/web/sites')
-rw-r--r--sys/web/sites/home.nix11
-rw-r--r--sys/web/sites/host.nix61
-rw-r--r--sys/web/sites/portal.nix15
3 files changed, 51 insertions, 36 deletions
diff --git a/sys/web/sites/home.nix b/sys/web/sites/home.nix
index 616bf94..fed9b84 100644
--- a/sys/web/sites/home.nix
+++ b/sys/web/sites/home.nix
@@ -1,9 +1,12 @@
-{ config, lib, ... }:
+{
+ config,
+ lib,
+ ...
+}:
with lib; let
cfg = config.local.web.sites.home;
inherit (config.local) domains;
-in
-{
+in {
options.local.web.sites.home = {
enable = mkEnableOption "home site";
@@ -15,7 +18,7 @@ in
config = mkIf cfg.enable {
local.web = {
enable = mkDefault true;
- ownedCerts = [ "home" ];
+ ownedCerts = ["home"];
};
services.nginx.virtualHosts.${domains.home.main} = {
diff --git a/sys/web/sites/host.nix b/sys/web/sites/host.nix
index 32ef1a6..ea6cc23 100644
--- a/sys/web/sites/host.nix
+++ b/sys/web/sites/host.nix
@@ -1,4 +1,8 @@
-{ config, lib, ... }:
+{
+ config,
+ lib,
+ ...
+}:
with lib; let
cfg = config.local.web.sites.host;
@@ -10,15 +14,15 @@ with lib; let
hostDomainName = "host-${hostname}";
userCerts = flatten (flatten (mapAttrsToList
- (name: user: map
+ (name: user:
+ map
(cert: {
fprint = config.local.pki.byPath.${cert}.fingerprint.sha1-lower;
inherit name;
})
user.mail.certs)
users));
-in
-{
+in {
options.local.web.sites.host = {
enable = mkEnableOption "host site, restricted to per-user client certs";
};
@@ -26,7 +30,7 @@ in
config = mkIf cfg.enable {
local.web = {
enable = mkDefault true;
- ownedCerts = [ hostDomainName ];
+ ownedCerts = [hostDomainName];
};
services = {
@@ -53,31 +57,36 @@ in
#}
'';
- locations = {
- "/".return = 403;
- } // concatMapAttrs
- (name: user:
- let
- userLocation = config: {
- extraConfig = ''
+ locations =
+ {
+ "/".return = 403;
+ }
+ // concatMapAttrs
+ (name: user: let
+ userLocation = config: {
+ extraConfig =
+ ''
if ($host_user_from_fprint != "${name}") {
return 403;
}
- '' + config;
- };
+ ''
+ + config;
+ };
- userLocations = {
+ userLocations =
+ {
"/${name}" = ''
return 404;
'';
- } // optionalAttrs user.mail.dav {
+ }
+ // optionalAttrs user.mail.dav {
"/${name}/dav" = ''
proxy_pass http://unix:/run/host-www/${name}/dav.sock;
'';
};
- in
+ in
mapAttrs (_: userLocation) userLocations)
- (filterAttrs (_: user: user.mail.certs != [ ]) users);
+ (filterAttrs (_: user: user.mail.certs != []) users);
};
};
};
@@ -85,13 +94,13 @@ in
systemd.tmpfiles.settings."10-run-host-www" =
concatMapAttrs
- (name: _: {
- "/run/host-www/${name}".d = {
- mode = "0750";
- user = name;
- group = "nginx";
- };
- })
- users;
+ (name: _: {
+ "/run/host-www/${name}".d = {
+ mode = "0750";
+ user = name;
+ group = "nginx";
+ };
+ })
+ users;
};
}
diff --git a/sys/web/sites/portal.nix b/sys/web/sites/portal.nix
index 2365ba1..fe96cfb 100644
--- a/sys/web/sites/portal.nix
+++ b/sys/web/sites/portal.nix
@@ -1,9 +1,12 @@
-{ config, lib, ... }:
+{
+ config,
+ lib,
+ ...
+}:
with lib; let
cfg = config.local.web.sites.portal;
inherit (config.local) domains;
-in
-{
+in {
options.local.web.sites.portal = {
enable = mkEnableOption "public non-fqdn portal";
};
@@ -11,7 +14,7 @@ in
config = mkIf cfg.enable {
local.web = {
enable = mkDefault true;
- ownedCerts = [ "host" "exdev" ];
+ ownedCerts = ["host" "exdev"];
defaultACMEHost = domains.host.main;
};
@@ -19,13 +22,13 @@ in
${domains.host.www} = {
forceSSL = true;
useACMEHost = domains.host.main;
- serverAliases = [ domains.host.main ];
+ serverAliases = [domains.host.main];
};
${domains.exdev.main} = {
forceSSL = true;
useACMEHost = domains.exdev.main;
- serverAliases = [ domains.exdev.www ];
+ serverAliases = [domains.exdev.www];
locations."/fsociety".return = "301 https://meet.posixlycorrect.com/%C6%92%C6%A8%C5%8F%C4%8B%D3%80%C9%99%CF%AE%D0%A3";
};