Skip to content

Commit

Permalink
allow to pick nextcloud package version
Browse files Browse the repository at this point in the history
refs #131
  • Loading branch information
ibizaman committed Jan 31, 2024
1 parent bccd6a1 commit 0c29b00
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions modules/services/nextcloud-server.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ let
contracts = pkgs.callPackage ../contracts {};

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

occ = "${config.services.nextcloud.occ}/bin/nextcloud-occ";
in
Expand Down Expand Up @@ -70,6 +70,12 @@ in
default = null;
};

version = lib.mkOption {
description = "Nextcloud version to choose from.";
type = lib.types.enum [ 27 28 ];
default = 27;
};

dataDir = lib.mkOption {
description = "Folder where Nextcloud will store all its data.";
type = lib.types.str;
Expand Down Expand Up @@ -459,7 +465,7 @@ in
# not loading to realize those scripts are inserted by extensions. Doh.
services.nextcloud = {
enable = true;
package = nextcloudPkg;
package = nextcloudPkg cfg.version;

datadir = cfg.dataDir;

Expand Down Expand Up @@ -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
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;
appstoreEnable = true;

Expand Down Expand Up @@ -604,7 +610,7 @@ in
];

services.nextcloud.extraApps = {
inherit (nextcloudApps) onlyoffice;
inherit ((nextcloudApps cfg.version)) onlyoffice;
};

services.onlyoffice = {
Expand Down Expand Up @@ -632,7 +638,7 @@ in

(lib.mkIf cfg.apps.previewgenerator.enable {
services.nextcloud.extraApps = {
inherit (nextcloudApps) previewgenerator;
inherit ((nextcloudApps cfg.version)) previewgenerator;
};

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

0 comments on commit 0c29b00

Please sign in to comment.