1
0
Fork 0

allow to pick nextcloud package version

refs #131
This commit is contained in:
ibizaman 2024-01-28 22:54:49 -08:00 committed by Pierre Penninckx
parent 38393af8d5
commit a2921edcbd

View file

@ -12,8 +12,8 @@ let
contracts = pkgs.callPackage ../contracts {}; contracts = pkgs.callPackage ../contracts {};
# Make sure to bump both nextcloudPkg and nextcloudApps at the same time. # Make sure to bump both nextcloudPkg and nextcloudApps at the same time.
nextcloudPkg = pkgs.nextcloud27; nextcloudPkg = version: builtins.getAttr ("nextcloud" + builtins.toString version) pkgs;
nextcloudApps = pkgs.nextcloud27Packages.apps; nextcloudApps = version: (builtins.getAttr ("nextcloud" + builtins.toString version + "Packages") pkgs).apps;
occ = "${config.services.nextcloud.occ}/bin/nextcloud-occ"; occ = "${config.services.nextcloud.occ}/bin/nextcloud-occ";
in in
@ -70,6 +70,12 @@ in
default = null; default = null;
}; };
version = lib.mkOption {
description = "Nextcloud version to choose from.";
type = lib.types.enum [ 27 28 ];
default = 27;
};
dataDir = lib.mkOption { dataDir = lib.mkOption {
description = "Folder where Nextcloud will store all its data."; description = "Folder where Nextcloud will store all its data.";
type = lib.types.str; type = lib.types.str;
@ -459,7 +465,7 @@ in
# not loading to realize those scripts are inserted by extensions. Doh. # not loading to realize those scripts are inserted by extensions. Doh.
services.nextcloud = { services.nextcloud = {
enable = true; enable = true;
package = nextcloudPkg; package = nextcloudPkg cfg.version;
datadir = cfg.dataDir; datadir = cfg.dataDir;
@ -490,7 +496,7 @@ in
# 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 # 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
https = !(isNull cfg.ssl); https = !(isNull cfg.ssl);
extraApps = if isNull cfg.extraApps then {} else cfg.extraApps nextcloudApps; extraApps = if isNull cfg.extraApps then {} else cfg.extraApps (nextcloudApps cfg.version);
extraAppsEnable = true; extraAppsEnable = true;
appstoreEnable = true; appstoreEnable = true;
@ -604,7 +610,7 @@ in
]; ];
services.nextcloud.extraApps = { services.nextcloud.extraApps = {
inherit (nextcloudApps) onlyoffice; inherit ((nextcloudApps cfg.version)) onlyoffice;
}; };
services.onlyoffice = { services.onlyoffice = {
@ -632,7 +638,7 @@ in
(lib.mkIf cfg.apps.previewgenerator.enable { (lib.mkIf cfg.apps.previewgenerator.enable {
services.nextcloud.extraApps = { services.nextcloud.extraApps = {
inherit (nextcloudApps) previewgenerator; inherit ((nextcloudApps cfg.version)) previewgenerator;
}; };
# Configured as defined in https://github.com/nextcloud/previewgenerator # Configured as defined in https://github.com/nextcloud/previewgenerator