git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #140159 from Ma27/nextcloud-misc

nextcloud: misc changes

commitcdb48d75c0b8bf4cdb9d5ba970afe376e29ed10e authorMaximilian Bosch <maximilian@mbosch.me> dateFri 1 Oct 2021, 21:08 (5 years ago) parent6d8986110703a8
5 files changed+45−12
nixos/modules/services/web-apps/nextcloud.nix+13−1 nixos/tests/nextcloud/basic.nix+5−2 nixos/tests/nextcloud/default.nix+17−5 nixos/tests/nextcloud/with-mysql-and-memcached.nix+5−2 nixos/tests/nextcloud/with-postgresql-and-redis.nix+5−2
nixos/modules/services/web-apps/nextcloud.nix+13−1
@@ -6,7 +6,7 @@ let
66 cfg = config.services.nextcloud;
77 fpm = config.services.phpfpm.pools.nextcloud;
88
9− phpPackage = pkgs.php74.buildEnv {
9+ phpPackage = cfg.phpPackage.buildEnv {
1010 extensions = { enabled, all }:
1111 (with all;
1212 enabled
@@ -94,6 +94,14 @@ in {
9494 description = "Which package to use for the Nextcloud instance.";
9595 relatedPackages = [ "nextcloud20" "nextcloud21" "nextcloud22" ];
9696 };
97+ phpPackage = mkOption {
98+ type = types.package;
99+ relatedPackages = [ "php74" "php80" ];
100+ defaultText = "pkgs.php";
101+ description = ''
102+ PHP package to use for Nextcloud.
103+ '';
104+ };
97105
98106 maxUploadSize = mkOption {
99107 default = "512M";
@@ -449,6 +457,10 @@ in {
449457 else if versionOlder stateVersion "21.11" then nextcloud21
450458 else nextcloud22
451459 );
460+
461+ services.nextcloud.phpPackage =
462+ if versionOlder cfg.package.version "21" then pkgs.php74
463+ else pkgs.php80;
452464 }
453465
454466 { systemd.timers.nextcloud-cron = {
nixos/tests/nextcloud/basic.nix+5−2
@@ -1,4 +1,6 @@
1−import ../make-test-python.nix ({ pkgs, ...}: let
1+args@{ pkgs, nextcloudVersion ? 22, ... }:
2+
3+(import ../make-test-python.nix ({ pkgs, ...}: let
24 adminpass = "notproduction";
35 adminuser = "root";
46in {
@@ -39,6 +41,7 @@ in {
3941 inherit adminpass;
4042 dbtableprefix = "nixos_";
4143 };
44+ package = pkgs.${"nextcloud" + (toString nextcloudVersion)};
4245 autoUpdateApps = {
4346 enable = true;
4447 startAt = "20:00";
@@ -100,4 +103,4 @@ in {
100103 )
101104 assert "hi" in client.succeed("cat /mnt/dav/test-shared-file")
102105 '';
103−})
106+})) args
nixos/tests/nextcloud/default.nix+17−5
@@ -2,8 +2,20 @@
22 config ? {},
33 pkgs ? import ../../.. { inherit system config; }
44}:
5−{
6− basic = import ./basic.nix { inherit system pkgs; };
7− with-postgresql-and-redis = import ./with-postgresql-and-redis.nix { inherit system pkgs; };
8− with-mysql-and-memcached = import ./with-mysql-and-memcached.nix { inherit system pkgs; };
9−}
5+
6+with pkgs.lib;
7+
8+foldl
9+ (matrix: ver: matrix // {
10+ "basic${toString ver}" = import ./basic.nix { inherit system pkgs; nextcloudVersion = ver; };
11+ "with-postgresql-and-redis${toString ver}" = import ./with-postgresql-and-redis.nix {
12+ inherit system pkgs;
13+ nextcloudVersion = ver;
14+ };
15+ "with-mysql-and-memcached${toString ver}" = import ./with-mysql-and-memcached.nix {
16+ inherit system pkgs;
17+ nextcloudVersion = ver;
18+ };
19+ })
20+ {}
21+ [ 20 21 22 ]
nixos/tests/nextcloud/with-mysql-and-memcached.nix+5−2
@@ -1,4 +1,6 @@
1−import ../make-test-python.nix ({ pkgs, ...}: let
1+args@{ pkgs, nextcloudVersion ? 22, ... }:
2+
3+(import ../make-test-python.nix ({ pkgs, ...}: let
24 adminpass = "hunter2";
35 adminuser = "root";
46in {
@@ -18,6 +20,7 @@ in {
1820 enable = true;
1921 hostName = "nextcloud";
2022 https = true;
23+ package = pkgs.${"nextcloud" + (toString nextcloudVersion)};
2124 caching = {
2225 apcu = true;
2326 redis = false;
@@ -103,4 +106,4 @@ in {
103106 "${withRcloneEnv} ${diffSharedFile}"
104107 )
105108 '';
106−})
109+})) args
nixos/tests/nextcloud/with-postgresql-and-redis.nix+5−2
@@ -1,4 +1,6 @@
1−import ../make-test-python.nix ({ pkgs, ...}: let
1+args@{ pkgs, nextcloudVersion ? 22, ... }:
2+
3+(import ../make-test-python.nix ({ pkgs, ...}: let
24 adminpass = "hunter2";
35 adminuser = "custom-admin-username";
46in {
@@ -17,6 +19,7 @@ in {
1719 services.nextcloud = {
1820 enable = true;
1921 hostName = "nextcloud";
22+ package = pkgs.${"nextcloud" + (toString nextcloudVersion)};
2023 caching = {
2124 apcu = false;
2225 redis = true;
@@ -96,4 +99,4 @@ in {
9699 "${withRcloneEnv} ${diffSharedFile}"
97100 )
98101 '';
99−})
102+})) args