summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2021-10-01 21:46:28 +0200
committerGitHub <noreply@github.com>2021-10-01 21:46:28 +0200
commit6385534d45cdfa63077677b0d1f72de37366d4b4 (patch)
treef0bcfef755471bf6cefbf84ed4ceb6dec2581dc1
parentMerge pull request #140183 from NixOS/backport-140172-to-release-21.05 (diff)
parentnixos/nextcloud: run tests against each Nextcloud instance (diff)
downloadnixpkgs-6385534d45cdfa63077677b0d1f72de37366d4b4.tar.gz
Merge pull request #140188 from NixOS/backport-140159-to-release-21.05
[Backport release-21.05] nextcloud: misc changes
-rw-r--r--nixos/modules/services/web-apps/nextcloud.nix14
-rw-r--r--nixos/tests/nextcloud/basic.nix7
-rw-r--r--nixos/tests/nextcloud/default.nix22
-rw-r--r--nixos/tests/nextcloud/with-mysql-and-memcached.nix7
-rw-r--r--nixos/tests/nextcloud/with-postgresql-and-redis.nix7
5 files changed, 45 insertions, 12 deletions
diff --git a/nixos/modules/services/web-apps/nextcloud.nix b/nixos/modules/services/web-apps/nextcloud.nix
index d047a7682331..4bfa564a67fe 100644
--- a/nixos/modules/services/web-apps/nextcloud.nix
+++ b/nixos/modules/services/web-apps/nextcloud.nix
@@ -6,7 +6,7 @@ let
cfg = config.services.nextcloud;
fpm = config.services.phpfpm.pools.nextcloud;
- phpPackage = pkgs.php74.buildEnv {
+ phpPackage = cfg.phpPackage.buildEnv {
extensions = { enabled, all }:
(with all;
enabled
@@ -94,6 +94,14 @@ in {
description = "Which package to use for the Nextcloud instance.";
relatedPackages = [ "nextcloud19" "nextcloud20" "nextcloud21" "nextcloud22" ];
};
+ phpPackage = mkOption {
+ type = types.package;
+ relatedPackages = [ "php74" "php80" ];
+ defaultText = "pkgs.php";
+ description = ''
+ PHP package to use for Nextcloud.
+ '';
+ };
maxUploadSize = mkOption {
default = "512M";
@@ -450,6 +458,10 @@ in {
else if versionOlder stateVersion "21.03" then nextcloud19
else nextcloud21
);
+
+ services.nextcloud.phpPackage =
+ if versionOlder cfg.package.version "21" then pkgs.php74
+ else pkgs.php80;
}
{ systemd.timers.nextcloud-cron = {
diff --git a/nixos/tests/nextcloud/basic.nix b/nixos/tests/nextcloud/basic.nix
index c4ce34748ace..40ee9d5184cc 100644
--- a/nixos/tests/nextcloud/basic.nix
+++ b/nixos/tests/nextcloud/basic.nix
@@ -1,4 +1,6 @@
-import ../make-test-python.nix ({ pkgs, ...}: let
+args@{ pkgs, nextcloudVersion ? 22, ... }:
+
+(import ../make-test-python.nix ({ pkgs, ...}: let
adminpass = "notproduction";
adminuser = "root";
in {
@@ -39,6 +41,7 @@ in {
inherit adminpass;
dbtableprefix = "nixos_";
};
+ package = pkgs.${"nextcloud" + (toString nextcloudVersion)};
autoUpdateApps = {
enable = true;
startAt = "20:00";
@@ -100,4 +103,4 @@ in {
)
assert "hi" in client.succeed("cat /mnt/dav/test-shared-file")
'';
-})
+})) args
diff --git a/nixos/tests/nextcloud/default.nix b/nixos/tests/nextcloud/default.nix
index e4c7a70606cf..65043e509b3b 100644
--- a/nixos/tests/nextcloud/default.nix
+++ b/nixos/tests/nextcloud/default.nix
@@ -2,8 +2,20 @@
config ? {},
pkgs ? import ../../.. { inherit system config; }
}:
-{
- basic = import ./basic.nix { inherit system pkgs; };
- with-postgresql-and-redis = import ./with-postgresql-and-redis.nix { inherit system pkgs; };
- with-mysql-and-memcached = import ./with-mysql-and-memcached.nix { inherit system pkgs; };
-}
+
+with pkgs.lib;
+
+foldl
+ (matrix: ver: matrix // {
+ "basic${toString ver}" = import ./basic.nix { inherit system pkgs; nextcloudVersion = ver; };
+ "with-postgresql-and-redis${toString ver}" = import ./with-postgresql-and-redis.nix {
+ inherit system pkgs;
+ nextcloudVersion = ver;
+ };
+ "with-mysql-and-memcached${toString ver}" = import ./with-mysql-and-memcached.nix {
+ inherit system pkgs;
+ nextcloudVersion = ver;
+ };
+ })
+ {}
+ [ 20 21 22 ]
diff --git a/nixos/tests/nextcloud/with-mysql-and-memcached.nix b/nixos/tests/nextcloud/with-mysql-and-memcached.nix
index de5f53d559a3..c0df773eaaa8 100644
--- a/nixos/tests/nextcloud/with-mysql-and-memcached.nix
+++ b/nixos/tests/nextcloud/with-mysql-and-memcached.nix
@@ -1,4 +1,6 @@
-import ../make-test-python.nix ({ pkgs, ...}: let
+args@{ pkgs, nextcloudVersion ? 22, ... }:
+
+(import ../make-test-python.nix ({ pkgs, ...}: let
adminpass = "hunter2";
adminuser = "root";
in {
@@ -18,6 +20,7 @@ in {
enable = true;
hostName = "nextcloud";
https = true;
+ package = pkgs.${"nextcloud" + (toString nextcloudVersion)};
caching = {
apcu = true;
redis = false;
@@ -103,4 +106,4 @@ in {
"${withRcloneEnv} ${diffSharedFile}"
)
'';
-})
+})) args
diff --git a/nixos/tests/nextcloud/with-postgresql-and-redis.nix b/nixos/tests/nextcloud/with-postgresql-and-redis.nix
index 81af620598ee..36a69fda505b 100644
--- a/nixos/tests/nextcloud/with-postgresql-and-redis.nix
+++ b/nixos/tests/nextcloud/with-postgresql-and-redis.nix
@@ -1,4 +1,6 @@
-import ../make-test-python.nix ({ pkgs, ...}: let
+args@{ pkgs, nextcloudVersion ? 22, ... }:
+
+(import ../make-test-python.nix ({ pkgs, ...}: let
adminpass = "hunter2";
adminuser = "custom-admin-username";
in {
@@ -17,6 +19,7 @@ in {
services.nextcloud = {
enable = true;
hostName = "nextcloud";
+ package = pkgs.${"nextcloud" + (toString nextcloudVersion)};
caching = {
apcu = false;
redis = true;
@@ -96,4 +99,4 @@ in {
"${withRcloneEnv} ${diffSharedFile}"
)
'';
-})
+})) args