summary refs log tree commit diff
diff options
context:
space:
mode:
authorMalte Brandy <malte.brandy@maralorn.de>2019-05-19 19:58:19 +0200
committerMalte Brandy <malte.brandy@maralorn.de>2019-05-21 13:24:23 +0200
commit49f05a17604322c42b8fc4150b25186dcbf9121f (patch)
treee8a028abe45cb977e562942139b385e709e3c834
parent2a3bb2f8ac3a3550c197e8c52db7155bf0aa2cd9 (diff)
downloadnixpkgs-49f05a17604322c42b8fc4150b25186dcbf9121f.tar
nixpkgs-49f05a17604322c42b8fc4150b25186dcbf9121f.tar.gz
nixpkgs-49f05a17604322c42b8fc4150b25186dcbf9121f.tar.bz2
nixpkgs-49f05a17604322c42b8fc4150b25186dcbf9121f.tar.lz
nixpkgs-49f05a17604322c42b8fc4150b25186dcbf9121f.tar.xz
nixpkgs-49f05a17604322c42b8fc4150b25186dcbf9121f.tar.zst
nixpkgs-49f05a17604322c42b8fc4150b25186dcbf9121f.zip
nixos/nextcloud: Add options services.nextcloud.autoUpdateApps
nixos/nextcloud: Add documentation for nextcloud app installation and updates

nixos/nextcloud: Enable autoUpdateApps in nextcloud test

nixos/nextcloud: Fix typo in nixos/modules/services/web-apps/nextcloud.xml

Co-Authored-By: Florian Klink <flokli@flokli.de>

nixos/nextcloud: Escape html in option description

nixos/nextcloud: Fix autoUpdateApps URL in documentation.

Co-Authored-By: Florian Klink <flokli@flokli.de>
-rw-r--r--nixos/modules/services/web-apps/nextcloud.nix22
-rw-r--r--nixos/modules/services/web-apps/nextcloud.xml6
-rw-r--r--nixos/tests/nextcloud/basic.nix4
3 files changed, 32 insertions, 0 deletions
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.&lt;name&gt;.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 @@
    <link xlink:href="https://github.com/NixOS/nixpkgs/issues/49783">#49783</link>,
    for now it's unfortunately necessary to manually work around these issues.
   </para>
+
+  <para>
+   Right now app installation and configuration is done imperatively in the nextcloud web ui or via the <literal>nextcloud-occ</literal> command line utility.
+   You can activate auto updates for your apps via
+   <literal><link linkend="opt-services.nextcloud.autoUpdateApps.enable">services.nextcloud.autoUpdateApps</link></literal>.
+  </para>
  </section>
 </chapter>
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";
+        };
       };
     };
   };