about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2024-01-10 22:50:09 +0900
committerNguyễn Gia Phong <cnx@loang.net>2024-01-10 22:50:09 +0900
commit1f1db48b9694265ef4df71bab1beb2c442ca49f7 (patch)
tree0d554a664987cb53a4baa052a6fefb64e37b3e1c
parent7503af7dba3ec66152ea230c423cd1a09a8c4158 (diff)
downloadnixos-conf-1f1db48b9694265ef4df71bab1beb2c442ca49f7.tar.gz
Fix wiki research backup
-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";
     };
   };