diff --git a/nixos/modules/services/web-apps/nextcloud.nix b/nixos/modules/services/web-apps/nextcloud.nix
index d0e45e1c12a..887478d0788 100644
--- a/nixos/modules/services/web-apps/nextcloud.nix
+++ b/nixos/modules/services/web-apps/nextcloud.nix
@@ -257,6 +257,23 @@ in {
'';
};
};
+ autoUpdateApps = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Run a auto update of all installed apps from the nextcloud repository.
+ '';
+ };
+ startAt = mkOption {
+ type = with types; either str (listOf str);
+ default = "05:00:00";
+ example = "Sun 14:00:00";
+ description = ''
+ When to run the update. See `systemd.services.<name>.startAt`.
+ '';
+ };
+ };
};
config = mkIf cfg.enable (mkMerge [
@@ -362,6 +379,11 @@ in {
serviceConfig.User = "nextcloud";
serviceConfig.ExecStart = "${phpPackage}/bin/php -f ${pkgs.nextcloud}/cron.php";
};
+ "nextcloud-update-plugins" = mkIf cfg.autoUpdateApps.enable {
+ serviceConfig.Type = "oneshot";
+ serviceConfig.ExecStart = "${occ}/bin/nextcloud-occ app:update --all";
+ startAt = cfg.autoUpdateApps.startAt;
+ };
};
services.phpfpm = {
diff --git a/nixos/modules/services/web-apps/nextcloud.xml b/nixos/modules/services/web-apps/nextcloud.xml
index dfefa55c5d5..d78d866086a 100644
--- a/nixos/modules/services/web-apps/nextcloud.xml
+++ b/nixos/modules/services/web-apps/nextcloud.xml
@@ -111,5 +111,11 @@
#49783,
for now it's unfortunately necessary to manually work around these issues.
+
+
+ Right now app installation and configuration is done imperatively in the nextcloud web ui or via the nextcloud-occ command line utility.
+ You can activate auto updates for your apps via
+ services.nextcloud.autoUpdateApps.
+
diff --git a/nixos/tests/nextcloud/basic.nix b/nixos/tests/nextcloud/basic.nix
index c3b710f0f90..bfb97ec3f23 100644
--- a/nixos/tests/nextcloud/basic.nix
+++ b/nixos/tests/nextcloud/basic.nix
@@ -22,6 +22,10 @@ in {
# Don't inherit adminuser since "root" is supposed to be the default
inherit adminpass;
};
+ autoUpdateApps = {
+ enable = true;
+ startAt = "20:00";
+ };
};
};
};