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; }; }
20 "descriptor:x25519:2EZQ3AOZXERDVSN6WO5LNSCOIIPL2AT2A7KOS4ZIYNVQDR5EFM2Q" # julm
23 client.onionServices.${onion} = {
24 clientAuthorizations = [
25 gnupg.secrets."tor/auth/julm".path
29 security.gnupg.secrets."tor/onion/${onion}/hs_ed25519_secret_key" = {
30 systemdConfig.before = [ "tor.service" ];
31 systemdConfig.wantedBy = [ "tor.service" ];
33 security.gnupg.secrets."tor/auth/julm" = {
34 systemdConfig.before = [ "tor.service" ];
35 systemdConfig.wantedBy = [ "tor.service" ];
38 virtualHosts."${srv}.${domain}" = {
39 serverAliases = [ domain "${onion}.onion" ];
46 access_log /var/log/nginx/${domain}/${srv}/access.log json buffer=32k;
47 error_log /var/log/nginx/${domain}/${srv}/error.log warn;
49 locations."/".extraConfig = ''
53 locations."/julm".extraConfig = ''
56 fancyindex_exact_size off;
57 fancyindex_name_length 255;
59 #open_file_cache_valid 1s;
61 locations."/haskell".extraConfig = ''
64 fancyindex_exact_size off;
65 fancyindex_name_length 255;
67 #open_file_cache_valid 1s;
69 locations."/sevy".extraConfig = ''
70 auth_basic "sevy's area";
71 auth_basic_user_file ${gnupg.secrets."nginx/sevy/htpasswd".path};
76 systemd.services.nginx = {
78 LogsDirectory = lib.mkForce ["nginx/${domain}/${srv}"];
80 "/home/julm/work/sourcephile/web:${root}/julm"
81 "/home/julm/dl:${root}/dl"
82 "/home/julm/work/sourcephile/haskell:${root}/haskell"
85 wants = [ gnupg.secrets."nginx/sevy/htpasswd".service ];
86 after = [ gnupg.secrets."nginx/sevy/htpasswd".service ];
88 security.gnupg.secrets."nginx/sevy/htpasswd" = {
89 # Generated with: echo "$user:$(openssl passwd -apr1)"