summary refs log tree commit diff
path: root/nixos/modules/services/web-apps/nextcloud.nix
diff options
context:
space:
mode:
authorDavHau <hsngrmpf+github@gmail.com>2020-07-27 12:41:42 +0700
committerDavHau <hsngrmpf+github@gmail.com>2020-07-27 12:41:42 +0700
commit5823ed784112361aed298cf865f29b51cd4a3f0a (patch)
tree821b473cb35da191162d130ee0e453a5e287dc97 /nixos/modules/services/web-apps/nextcloud.nix
parentfd9eb16b249aad1d5e231b8329035abfab5fc0eb (diff)
downloadnixpkgs-5823ed784112361aed298cf865f29b51cd4a3f0a.tar
nixpkgs-5823ed784112361aed298cf865f29b51cd4a3f0a.tar.gz
nixpkgs-5823ed784112361aed298cf865f29b51cd4a3f0a.tar.bz2
nixpkgs-5823ed784112361aed298cf865f29b51cd4a3f0a.tar.lz
nixpkgs-5823ed784112361aed298cf865f29b51cd4a3f0a.tar.xz
nixpkgs-5823ed784112361aed298cf865f29b51cd4a3f0a.tar.zst
nixpkgs-5823ed784112361aed298cf865f29b51cd4a3f0a.zip
nextcloud: fix group permissions on startup
Diffstat (limited to 'nixos/modules/services/web-apps/nextcloud.nix')
-rw-r--r--nixos/modules/services/web-apps/nextcloud.nix12
1 files changed, 11 insertions, 1 deletions
diff --git a/nixos/modules/services/web-apps/nextcloud.nix b/nixos/modules/services/web-apps/nextcloud.nix
index 61722e6627d..14858e2456e 100644
--- a/nixos/modules/services/web-apps/nextcloud.nix
+++ b/nixos/modules/services/web-apps/nextcloud.nix
@@ -458,7 +458,17 @@ in {
           script = ''
             chmod og+x ${cfg.home}
             ln -sf ${cfg.package}/apps ${cfg.home}/
-            install -o nextcloud -g nextcloud -d ${cfg.home}/config ${cfg.home}/data ${cfg.home}/store-apps
+
+            # create nextcloud directories.
+            # if the directories exist already with wrong permissions, we fix that
+            for dir in ${cfg.home}/config ${cfg.home}/data ${cfg.home}/store-apps; do
+              if [ ! -e $dir ]; then
+                install -o nextcloud -g nextcloud -d $dir
+              elif [ $(stat -c "%G" $dir) != "nextcloud" ]; then
+                chown -R nextcloud:nextcloud $dir
+              fi
+            done
+
             ln -sf ${overrideConfig} ${cfg.home}/config/override.config.php
 
             # Do not install if already installed