about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--wikiwiki.nix22
1 files changed, 3 insertions, 19 deletions
diff --git a/wikiwiki.nix b/wikiwiki.nix
index db53a8a..a5cb5b5 100644
--- a/wikiwiki.nix
+++ b/wikiwiki.nix
@@ -41,29 +41,12 @@ in {
       name = "Research on Wikipedia governance";
       nginx.hostName = hostname;
       passwordFile = "/dev/null"; # this is so dumb
-      uploadsDir = "/mnt/nas/www/nhanh.loang.net";
       webserver = "nginx";
     };
 
     nginx.virtualHosts.${hostname} = {
       enableACME = true;
       forceSSL = true;
-      # Work around resources not found:
-      # https://github.com/NixOS/nixpkgs/pull/255776#issuecomment-1759131411
-      locations = let
-        inherit (lib) mkForce;
-        rewrite = {
-          extraConfig = mkForce ''
-            rewrite ^/w/(.*) /$1 break;
-            add_header Cache-Control "public";
-            expires 7d;
-          '';
-          tryFiles = mkForce null;
-        };
-      in {
-        "~ ^/w/resources/(assets|lib|src)" = rewrite;
-        "~ ^/w/(skins|extensions)/.+\\.(css|js|gif|jpg|jpeg|png|svg|wasm|ttf|woff|woff2)$" = rewrite;
-      };
     };
 
     phpfpm.pools.mediawiki.phpOptions = ''
@@ -101,13 +84,14 @@ in {
       "wiki-uploads-backup" = service "mediawiki" ''
         backup=/mnt/nas/backup/nhanh.loang.net
         ${pkgs.rsync}/bin/rsync -a --delete\
-          /mnt/nas/www/nhanh.loang.net/ $backup/latest/
+          ${config.services.mediawiki.uploadsDir}/ $backup/latest/
+        ${pkgs.coreutils}/bin/chown -R mediawiki:mediawiki $backup/latest/
         today=$(${pkgs.coreutils}/bin/date --iso-8601)
         ${pkgs.coreutils}/bin/cp -al $backup/{latest,$today}
       '';
     };
     timers = {
-      "wiki-db-backup" = timer "wiki-uploads-backup";
+      "wiki-db-backup" = timer "wiki-db-backup";
       "wiki-uploads-backup" = timer "wiki-uploads-backup";
     };
   };