diff options
-rw-r--r-- | custom/ymir-nginx.nix | 39 | ||||
-rw-r--r-- | ymir.nix | 37 |
2 files changed, 74 insertions, 2 deletions
diff --git a/custom/ymir-nginx.nix b/custom/ymir-nginx.nix index a36ac79e..1a02d4c7 100644 --- a/custom/ymir-nginx.nix +++ b/custom/ymir-nginx.nix | |||
@@ -95,6 +95,45 @@ in { | |||
95 | listen [::]:80; | 95 | listen [::]:80; |
96 | listen *:443 ssl; | 96 | listen *:443 ssl; |
97 | listen [::]:443 ssl; | 97 | listen [::]:443 ssl; |
98 | server_name ~^(.*\.)?(f|files)\.(yggdrasil\.li|141\.li|praseodym\.org)$; | ||
99 | |||
100 | include ${favicon}; | ||
101 | include ${acme}; | ||
102 | |||
103 | root /srv/www/files; | ||
104 | } | ||
105 | |||
106 | server { | ||
107 | listen *:80; | ||
108 | listen *:443 ssl; | ||
109 | listen [::]:80; | ||
110 | listen [::]:443 ssl; | ||
111 | server_name ~^(.*\.)?git\.yggdrasil\.li$; | ||
112 | |||
113 | root ${pkgs.cgit}/cgit; | ||
114 | |||
115 | try_files $uri @cgit; | ||
116 | |||
117 | include ${favicon}; | ||
118 | include ${acme}; | ||
119 | |||
120 | location @cgit { | ||
121 | include ${uwsgi_params}; | ||
122 | uwsgi_pass unix:/tmp/cgit.sock; | ||
123 | uwsgi_modifier1 9; | ||
124 | } | ||
125 | } | ||
126 | ''; | ||
127 | }; | ||
128 | } | ||
129 | |||
130 | } | ||
131 | |||
132 | server { | ||
133 | listen *:80; | ||
134 | listen [::]:80; | ||
135 | listen *:443 ssl; | ||
136 | listen [::]:443 ssl; | ||
98 | server_name ~^(.*\.)?dirty-haskell\.org$; | 137 | server_name ~^(.*\.)?dirty-haskell\.org$; |
99 | 138 | ||
100 | include ${favicon}; | 139 | include ${favicon}; |
@@ -78,6 +78,34 @@ in rec { | |||
78 | wrapProgram $out/lib/cgit/filters/html-converters/man2html --prefix PATH ':' ${pkgs.groff}/bin | 78 | wrapProgram $out/lib/cgit/filters/html-converters/man2html --prefix PATH ':' ${pkgs.groff}/bin |
79 | ''; | 79 | ''; |
80 | }); | 80 | }); |
81 | push2bin = pkgs.writeScriptBin "push2bin" '' | ||
82 | #!${pkgs.zsh}/bin/zsh | ||
83 | |||
84 | PATH=${pkgs.coreutils}/bin | ||
85 | |||
86 | baseDir=/srv/www/files | ||
87 | baseUrl="https://f.141.li" | ||
88 | |||
89 | tmpFile=$(mktemp "$baseDir/.upload.XXXXXXXXXX") | ||
90 | |||
91 | TRAPEXIT() { [[ -n "''${tmpFile}" && -e "''${tmpFile}" ]] && rm -f "''${tmpFile}" } | ||
92 | |||
93 | prefix=$(sha512sum "''${tmpFile}" | awk '{ print $1; }' | head -c 10) | ||
94 | prefix=''${prefix:l} | ||
95 | filename="$1" | ||
96 | |||
97 | [[ -z "''${prefix}" ]] && exit 2; | ||
98 | [[ -z "''${filename}" ]] && exit 2; | ||
99 | [[ $(stat -c '%s' ''${tmpFile}) == "0" ]] && exit 2; | ||
100 | |||
101 | mkdir -p "''${baseDir}/''${prefix}" | ||
102 | mv $tmpFile "''${baseDir}/''${prefix}/''${filename}" | ||
103 | |||
104 | chmod 750 "''${baseDir}/''${prefix}" | ||
105 | chmod 640 "''${baseDir}/''${prefix}/''${filename}" | ||
106 | |||
107 | printf "%s/%s/%s" "''${baseUrl}" "''${prefix}" "''${filename}" | ||
108 | ''; | ||
81 | }; | 109 | }; |
82 | 110 | ||
83 | environment.systemPackages = with pkgs; [ | 111 | environment.systemPackages = with pkgs; [ |
@@ -438,7 +466,7 @@ in rec { | |||
438 | webroot = "/srv/www/acme/yggdrasil.li"; | 466 | webroot = "/srv/www/acme/yggdrasil.li"; |
439 | email = "phikeebaogobaegh@141.li"; | 467 | email = "phikeebaogobaegh@141.li"; |
440 | extraDomains = builtins.listToAttrs (builtins.map (name: { inherit name; value = "/srv/www/acme/${name}"; }) | 468 | extraDomains = builtins.listToAttrs (builtins.map (name: { inherit name; value = "/srv/www/acme/${name}"; }) |
441 | ["dirty-haskell.org" "www.dirty-haskell.org" "ymir.141.li" "141.li" "www.141.li" "ymir.xmpp.li" "xmpp.li" "www.xmpp.li" "ymir.yggdrasil.li" "git.yggdrasil.li" "www.yggdrasil.li" "yggdrasil.li" "ymir.praseodym.org" "praseodym.org" "www.praseodym.org"]); | 469 | ["dirty-haskell.org" "www.dirty-haskell.org" "files.141.li" "f.141.li" "ymir.141.li" "141.li" "www.141.li" "ymir.xmpp.li" "xmpp.li" "www.xmpp.li" "files.yggdrasil.li" "f.yggdrasil.li" "ymir.yggdrasil.li" "git.yggdrasil.li" "www.yggdrasil.li" "yggdrasil.li" "files.praseodym.org" "f.praseodym.org" "ymir.praseodym.org" "praseodym.org" "www.praseodym.org"]); |
442 | postRun = '' | 470 | postRun = '' |
443 | systemctl reload nginx.service | 471 | systemctl reload nginx.service |
444 | prosodyctl reload | 472 | prosodyctl reload |
@@ -460,10 +488,15 @@ in rec { | |||
460 | Hostname odin.asgard.yggdrasil | 488 | Hostname odin.asgard.yggdrasil |
461 | IdentityFile ~/.ssh/odin | 489 | IdentityFile ~/.ssh/odin |
462 | ''; | 490 | ''; |
463 | defaultCommands = ["rmail"]; | 491 | commandPath = ["${pkgs.rmail}/bin" "${pkgs.push2bin}/bin"]; |
492 | defaultCommands = ["rmail" "push2bin"]; | ||
464 | }; | 493 | }; |
465 | 494 | ||
466 | services.atd = { | 495 | services.atd = { |
467 | enable = true; | 496 | enable = true; |
468 | }; | 497 | }; |
498 | |||
499 | users.groups."filebin" = { | ||
500 | members = ["gkleen" "uucp"]; | ||
501 | }; | ||
469 | } | 502 | } |