Skip to content

Commit

Permalink
Merge pull request #115142 from Ma27/nextcloud21-20.09
Browse files Browse the repository at this point in the history
[20.09] nextcloud: init at 21.0.0
  • Loading branch information
Ma27 committed Mar 5, 2021
2 parents d284abb + da0234e commit 1ac507b
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 7 deletions.
47 changes: 42 additions & 5 deletions nixos/modules/services/web-apps/nextcloud.nix
Expand Up @@ -26,7 +26,10 @@ let
upload_max_filesize = cfg.maxUploadSize;
post_max_size = cfg.maxUploadSize;
memory_limit = cfg.maxUploadSize;
} // cfg.phpOptions;
} // cfg.phpOptions
// optionalAttrs cfg.caching.apcu {
"apc.enable_cli" = "1";
};
phpOptionsStr = toKeyValue phpOptions;

occ = pkgs.writeScriptBin "nextcloud-occ" ''
Expand Down Expand Up @@ -85,7 +88,7 @@ in {
package = mkOption {
type = types.package;
description = "Which package to use for the Nextcloud instance.";
relatedPackages = [ "nextcloud18" "nextcloud19" "nextcloud20" ];
relatedPackages = [ "nextcloud18" "nextcloud19" "nextcloud20" "nextcloud21" ];
};

maxUploadSize = mkOption {
Expand Down Expand Up @@ -264,6 +267,24 @@ in {
may be served via HTTPS.
'';
};

defaultPhoneRegion = mkOption {
default = null;
type = types.nullOr types.str;
example = "DE";
description = ''
<warning>
<para>This option exists since Nextcloud 21! If older versions are used,
this will throw an eval-error!</para>
</warning>
<link xlink:href="https://www.iso.org/iso-3166-country-codes.html">ISO 3611-1</link>
country codes for automatic phone-number detection without a country code.
With e.g. <literal>DE</literal> set, the <literal>+49</literal> can be omitted for
phone-numbers.
'';
};
};

caching = {
Expand Down Expand Up @@ -329,6 +350,9 @@ in {
&& !(acfg.adminpass != null && acfg.adminpassFile != null));
message = "Please specify exactly one of adminpass or adminpassFile";
}
{ assertion = versionOlder cfg.package.version "21" -> cfg.config.defaultPhoneRegion == null;
message = "The `defaultPhoneRegion'-setting is only supported for Nextcloud >=21!";
}
];

warnings = []
Expand Down Expand Up @@ -362,9 +386,10 @@ in {
support upgrades that skip multiple versions (i.e. an upgrade from 17 to 19 isn't
possible, but an upgrade from 18 to 19).
'')
++ (optional (versionOlder cfg.package.version "20") ''
The latest Nextcloud release is v20 which can be installed by setting
`services.nextcloud.package` to `pkgs.nextcloud20`.
++ (optional (versionOlder cfg.package.version "21") ''
The latest Nextcloud release is v21 which can be installed by setting
`services.nextcloud.package` to `pkgs.nextcloud21`. Please note that if you're
on `pkgs.nextcloud19`, you'll have to install `pkgs.nextcloud20` first.
'');

services.nextcloud.package = with pkgs;
Expand Down Expand Up @@ -433,6 +458,7 @@ in {
'dbtype' => '${c.dbtype}',
'trusted_domains' => ${writePhpArrary ([ cfg.hostName ] ++ c.extraTrustedDomains)},
'trusted_proxies' => ${writePhpArrary (c.trustedProxies)},
${optionalString (c.defaultPhoneRegion != null) "'default_phone_region' => '${c.defaultPhoneRegion}',"}
];
'';
occInstallCmd = let
Expand Down Expand Up @@ -582,6 +608,14 @@ in {
access_log off;
'';
};
"= /" = {
priority = 100;
extraConfig = ''
if ( $http_user_agent ~ ^DavClnt ) {
return 302 /remote.php/webdav/$is_args$args;
}
'';
};
"/" = {
priority = 900;
extraConfig = "rewrite ^ /index.php;";
Expand All @@ -600,6 +634,9 @@ in {
location = /.well-known/caldav {
return 301 /remote.php/dav;
}
location ~ ^/\.well-known/(?!acme-challenge|pki-validation) {
return 301 /index.php$request_uri;
}
try_files $uri $uri/ =404;
'';
};
Expand Down
3 changes: 2 additions & 1 deletion nixos/modules/services/web-apps/nextcloud.xml
Expand Up @@ -12,7 +12,8 @@
</para>
<para>
The current default by NixOS is <package>nextcloud19</package> though it's recommended
to upgrade to the latest version, <package>nextcloud20</package>.
to upgrade to the latest version, <package>nextcloud21</package>. Please note that it's necessary
to install <package>nextcloud20</package> first!
</para>
<section xml:id="module-services-nextcloud-basic-usage">
<title>Basic usage</title>
Expand Down
5 changes: 5 additions & 0 deletions pkgs/servers/nextcloud/default.nix
Expand Up @@ -61,4 +61,9 @@ in {
version = "20.0.7";
sha256 = "sha256-jO2Ct3K/CvZ9W+EyPkD5d0KbwKK8yGQJXvx4dnUAtys=";
};

nextcloud21 = generic {
version = "21.0.0";
sha256 = "sha256-zq2u72doWhGvxbI7Coa6PHvQp7E41dHswFJiODZV8fA=";
};
}
2 changes: 1 addition & 1 deletion pkgs/top-level/all-packages.nix
Expand Up @@ -5713,7 +5713,7 @@ in
grocy = callPackage ../servers/grocy { };

inherit (callPackage ../servers/nextcloud {})
nextcloud17 nextcloud18 nextcloud19 nextcloud20;
nextcloud17 nextcloud18 nextcloud19 nextcloud20 nextcloud21;

nextcloud-client = libsForQt5.callPackage ../applications/networking/nextcloud-client { };

Expand Down

0 comments on commit 1ac507b

Please sign in to comment.