Skip to content

Commit a2921ed

Browse files
ibizamanibizaman
ibizaman
authored andcommitted
allow to pick nextcloud package version
refs #131
1 parent 38393af commit a2921ed

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

modules/services/nextcloud-server.nix

+12-6
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ let
1212
contracts = pkgs.callPackage ../contracts {};
1313

1414
# Make sure to bump both nextcloudPkg and nextcloudApps at the same time.
15-
nextcloudPkg = pkgs.nextcloud27;
16-
nextcloudApps = pkgs.nextcloud27Packages.apps;
15+
nextcloudPkg = version: builtins.getAttr ("nextcloud" + builtins.toString version) pkgs;
16+
nextcloudApps = version: (builtins.getAttr ("nextcloud" + builtins.toString version + "Packages") pkgs).apps;
1717

1818
occ = "${config.services.nextcloud.occ}/bin/nextcloud-occ";
1919
in
@@ -70,6 +70,12 @@ in
7070
default = null;
7171
};
7272

73+
version = lib.mkOption {
74+
description = "Nextcloud version to choose from.";
75+
type = lib.types.enum [ 27 28 ];
76+
default = 27;
77+
};
78+
7379
dataDir = lib.mkOption {
7480
description = "Folder where Nextcloud will store all its data.";
7581
type = lib.types.str;
@@ -459,7 +465,7 @@ in
459465
# not loading to realize those scripts are inserted by extensions. Doh.
460466
services.nextcloud = {
461467
enable = true;
462-
package = nextcloudPkg;
468+
package = nextcloudPkg cfg.version;
463469

464470
datadir = cfg.dataDir;
465471

@@ -490,7 +496,7 @@ in
490496
# Very important for a bunch of scripts to load correctly. Otherwise you get Content-Security-Policy errors. See https://docs.nextcloud.com/server/13/admin_manual/configuration_server/harden_server.html#enable-http-strict-transport-security
491497
https = !(isNull cfg.ssl);
492498

493-
extraApps = if isNull cfg.extraApps then {} else cfg.extraApps nextcloudApps;
499+
extraApps = if isNull cfg.extraApps then {} else cfg.extraApps (nextcloudApps cfg.version);
494500
extraAppsEnable = true;
495501
appstoreEnable = true;
496502

@@ -604,7 +610,7 @@ in
604610
];
605611

606612
services.nextcloud.extraApps = {
607-
inherit (nextcloudApps) onlyoffice;
613+
inherit ((nextcloudApps cfg.version)) onlyoffice;
608614
};
609615

610616
services.onlyoffice = {
@@ -632,7 +638,7 @@ in
632638

633639
(lib.mkIf cfg.apps.previewgenerator.enable {
634640
services.nextcloud.extraApps = {
635-
inherit (nextcloudApps) previewgenerator;
641+
inherit ((nextcloudApps cfg.version)) previewgenerator;
636642
};
637643

638644
# Configured as defined in https://github.com/nextcloud/previewgenerator

0 commit comments

Comments
 (0)