2 { pkgs, lib, config, ... }:
4 inherit (config) networking;
5 inherit (config.security) gnupg;
6 inherit (config.services) nginx;
8 root = "/var/lib/nginx";
9 onion = "dfc66yn2fundui5yvq2ndx4nmcmbxpho4ji32tlc4cncrjvs2b5yu4id";
13 relay.onionServices."nginx/${domain}/${srv}" = {
14 secretKey = gnupg.secrets."tor/onion/${onion}/hs_ed25519_secret_key".path;
17 #{ port = 443; target = { port = 8443; }; }
21 "descriptor:x25519:2EZQ3AOZXERDVSN6WO5LNSCOIIPL2AT2A7KOS4ZIYNVQDR5EFM2Q" # julm
26 client.onionServices.${onion} = {
27 clientAuthorizations = [
28 gnupg.secrets."tor/auth/julm".path
33 security.gnupg.secrets = lib.genAttrs [
34 "tor/onion/${onion}/hs_ed25519_secret_key"
37 systemdConfig.before = [ "tor.service" ];
38 systemdConfig.wantedBy = [ "tor.service" ];
40 "nginx/sevy/htpasswd" = {
41 # Generated with: echo "$user:$(openssl passwd -apr1)"
42 systemdConfig.before = [ "nginx.service" ];
43 systemdConfig.wantedBy = [ "nginx.service" ];
49 virtualHosts."${onion}.onion" = {
52 access_log /var/log/nginx/${domain}/${srv}/access.log json buffer=32k;
53 error_log /var/log/nginx/${domain}/${srv}/error.log warn;
55 locations."/".extraConfig = ''
58 fancyindex_exact_size off;
59 fancyindex_name_length 255;
61 #open_file_cache_valid 1s;
64 virtualHosts."${srv}.${domain}" = {
65 serverAliases = [ domain ];
72 access_log /var/log/nginx/${domain}/${srv}/access.log json buffer=32k;
73 error_log /var/log/nginx/${domain}/${srv}/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."/sevy".extraConfig = ''
104 auth_basic "sevy's area";
105 auth_basic_user_file ${gnupg.secrets."nginx/sevy/htpasswd".path};
110 systemd.services.nginx = {
112 LogsDirectory = lib.mkForce ["nginx/${domain}/${srv}"];
113 BindReadOnlyPaths = [
114 "/home/julm/work/sourcephile/web:${root}/julm"
115 "/home/julm/dl:${root}/dl"
116 "/home/julm/work/sourcephile/haskell:${root}/haskell"