2 { lib, config, hostName, ... }:
4 inherit (config.security) gnupg;
5 inherit (config.services) nginx;
6 root = "/var/lib/nginx";
7 onion = "dfc66yn2fundui5yvq2ndx4nmcmbxpho4ji32tlc4cncrjvs2b5yu4id";
11 relay.onionServices."nginx/${domain}/${hostName}" = {
12 secretKey = gnupg.secrets."tor/onion/${onion}/hs_ed25519_secret_key".path;
15 #{ port = 443; target = { port = 8443; }; }
19 "descriptor:x25519:2EZQ3AOZXERDVSN6WO5LNSCOIIPL2AT2A7KOS4ZIYNVQDR5EFM2Q" # julm
24 client.onionServices.${onion} = {
25 clientAuthorizations = [
26 gnupg.secrets."tor/auth/julm".path
31 security.gnupg.secrets = lib.genAttrs [
32 "tor/onion/${onion}/hs_ed25519_secret_key"
36 systemdConfig.before = [ "tor.service" ];
37 systemdConfig.wantedBy = [ "tor.service" ];
39 "nginx/perso/htpasswd" = {
40 # Generated with: for i in $PASSWORD_STORE_DIR/hosts/losurdo/nginx/perso/htpasswd/*.gpg; do i="${i#$PASSWORD_STORE_DIR/}"; i=${i%.gpg}; printf %s: "${i##*/}"; pass $i | openssl passwd -apr1 -stdin; done | pass insert -m hosts/losurdo/nginx/perso/htpasswd
41 # Then: nix flake lock --update-input pass
42 systemdConfig.before = [ "nginx.service" ];
43 systemdConfig.wantedBy = [ "nginx.service" ];
49 virtualHosts."${onion}.onion" = {
52 access_log /var/log/nginx/${domain}/${hostName}/access.json json buffer=32k;
53 error_log /var/log/nginx/${domain}/${hostName}/error.log warn;
55 locations."/".extraConfig = ''
58 fancyindex_exact_size off;
59 fancyindex_name_length 255;
61 #open_file_cache_valid 1s;
64 virtualHosts."${hostName}.${domain}" = {
65 serverAliases = [ domain ];
72 access_log /var/log/nginx/${domain}/${hostName}/access.json json buffer=32k;
73 error_log /var/log/nginx/${domain}/${hostName}/error.log warn;
75 locations."/".extraConfig = ''
79 locations."/dl".extraConfig = ''
82 fancyindex_exact_size off;
83 fancyindex_name_length 255;
85 #open_file_cache_valid 1s;
87 locations."/julm".extraConfig = ''
90 fancyindex_exact_size off;
91 fancyindex_name_length 255;
93 #open_file_cache_valid 1s;
95 locations."/haskell".extraConfig = ''
98 fancyindex_exact_size off;
99 fancyindex_name_length 255;
101 #open_file_cache_valid 1s;
103 locations."/perso" = {
104 basicAuthFile = gnupg.secrets."nginx/perso/htpasswd".path;
111 systemd.services.nginx = {
113 LogsDirectory = lib.mkForce [
114 "nginx/${domain}/${hostName}"
115 "nginx/wg-intra/${hostName}"
117 BindReadOnlyPaths = [
118 "/home/julm/work/sourcephile/web:${root}/julm"
119 "/home/julm/dl:${root}/dl"
120 "/home/julm/work/sourcephile/haskell:${root}/haskell"
121 "/home/julm/perso:${root}/perso"