]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - nixops/modules/websites/tools/mastodon/default.nix
Upgrade to latest nixpkgs
[perso/Immae/Config/Nix.git] / nixops / modules / websites / tools / mastodon / default.nix
index 0aaff70ed6fe2719e11af07211d8fee87f2a2425..b0ace5681988e95f0c17bb47203484a1b33f9c3b 100644 (file)
@@ -1,10 +1,11 @@
-{ lib, pkgs, config, myconfig, mylibs, ... }:
+{ lib, pkgs, pkgsPrevious, config, myconfig, mylibs, ... }:
 let
-  mastodon = pkgs.callPackage ./mastodon.nix {
+  mastodon = pkgsPrevious.callPackage ./mastodon.nix {
     inherit (mylibs) fetchedGithub;
     env = myconfig.env.tools.mastodon;
   };
 
+  root = "/run/current-system/webapps/tools_mastodon";
   cfg = config.services.myWebsites.tools.mastodon;
 in {
   options.services.myWebsites.tools.mastodon = {
@@ -20,7 +21,7 @@ in {
       uid = config.ids.uids.mastodon;
       group = "mastodon";
       description = "Mastodon user";
-      home = mastodon.railsRoot;
+      home = mastodon.varDir;
       useDefaultShell = true;
     };
 
@@ -138,10 +139,14 @@ in {
       "headers" "proxy" "proxy_wstunnel" "proxy_http"
     ];
     security.acme.certs."eldiron".extraDomains."mastodon.immae.eu" = null;
+    system.extraSystemBuilderCmds = ''
+      mkdir -p $out/webapps
+      ln -s ${mastodon.railsRoot}/public/ $out/webapps/tools_mastodon
+      '';
     services.myWebsites.tools.vhostConfs.mastodon = {
       certName    = "eldiron";
       hosts       = ["mastodon.immae.eu" ];
-      root        = "${mastodon.railsRoot}/public/";
+      root        = root;
       extraConfig = [ ''
         Header always set Referrer-Policy "strict-origin-when-cross-origin"
         Header always set Strict-Transport-Security "max-age=31536000"
@@ -178,7 +183,7 @@ in {
           Options -MultiViews
         </Directory>
 
-        <Directory ${mastodon.railsRoot}/public/>
+        <Directory ${root}>
           Require all granted
           Options -MultiViews +FollowSymlinks
         </Directory>