git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #99596 from Ma27/nextcloud20

nextcloud20: init

commit41c0f49681009ceb57a65b7cd7d4e6d605df712c authorLinus Heckemann <git@sphalerite.org> dateWed 7 Oct 2020, 08:10 (6 years ago) parenta25bd669cbe30e
4 files changed+46−39
nixos/doc/manual/release-notes/rl-2103.xml+10−1 nixos/modules/services/web-apps/nextcloud.nix+30−37 pkgs/servers/nextcloud/default.nix+5 pkgs/top-level/all-packages.nix+1−1
nixos/doc/manual/release-notes/rl-2103.xml+10−1
@@ -83,7 +83,16 @@
8383
8484 <itemizedlist>
8585 <listitem>
86− <para />
86+ <para>
87+ The default-version of <literal>nextcloud</literal> is <package>nextcloud20</package>.
88+ Please note that it's <emphasis>not</emphasis> possible to upgrade <literal>nextcloud</literal>
89+ across multiple major versions! This means that it's e.g. not possible to upgrade
90+ from <package>nextcloud18</package> to <package>nextcloud20</package> in a single deploy.
91+ </para>
92+ <para>
93+ The package can be manually upgraded by setting <xref linkend="opt-services.nextcloud.package" />
94+ to <package>nextcloud20</package>.
95+ </para>
8796 </listitem>
8897 </itemizedlist>
8998 </section>
nixos/modules/services/web-apps/nextcloud.nix+30−37
@@ -85,7 +85,7 @@ in {
8585 package = mkOption {
8686 type = types.package;
8787 description = "Which package to use for the Nextcloud instance.";
88− relatedPackages = [ "nextcloud18" "nextcloud19" ];
88+ relatedPackages = [ "nextcloud18" "nextcloud19" "nextcloud20" ];
8989 };
9090
9191 maxUploadSize = mkOption {
@@ -330,37 +330,28 @@ in {
330330 }
331331 ];
332332
333− warnings = []
334− ++ (optional (cfg.poolConfig != null) ''
335− Using config.services.nextcloud.poolConfig is deprecated and will become unsupported in a future release.
336− Please migrate your configuration to config.services.nextcloud.poolSettings.
337− '')
338− ++ (optional (versionOlder cfg.package.version "18") ''
339− A legacy Nextcloud install (from before NixOS 20.03) may be installed.
340−
341− You're currently deploying an older version of Nextcloud. This may be needed
342− since Nextcloud doesn't allow major version upgrades that skip multiple
343− versions (i.e. an upgrade from 16 is possible to 17, but not 16 to 18).
344−
345− It is assumed that Nextcloud will be upgraded from version 16 to 17.
333+ warnings = let
334+ latest = 20;
335+ upgradeWarning = major: nixos:
336+ ''
337+ A legacy Nextcloud install (from before NixOS ${nixos}) may be installed.
346338
347− * If this is a fresh install, there will be no upgrade to do now.
339+ After nextcloud${toString major} is installed successfully, you can safely upgrade
340+ to ${toString (major + 1)}. The latest version available is nextcloud${toString latest}.
348341
349− * If this server already had Nextcloud installed, first deploy this to your
350− server, and wait until the upgrade to 17 is finished.
342+ Please note that Nextcloud doesn't support upgrades across multiple major versions
343+ (i.e. an upgrade from 16 is possible to 17, but not 16 to 18).
351344
352− Then, set `services.nextcloud.package` to `pkgs.nextcloud18` to upgrade to
353− Nextcloud version 18. Please note that Nextcloud 19 is already out and it's
354− recommended to upgrade to nextcloud19 after that.
345+ The package can be upgraded by explicitly declaring the service-option
346+ `services.nextcloud.package`.
347+ '';
348+ in (optional (cfg.poolConfig != null) ''
349+ Using config.services.nextcloud.poolConfig is deprecated and will become unsupported in a future release.
350+ Please migrate your configuration to config.services.nextcloud.poolSettings.
355351 '')
356− ++ (optional (versionOlder cfg.package.version "19") ''
357− A legacy Nextcloud install (from before NixOS 20.09) may be installed.
358−
359− If/After nextcloud18 is installed successfully, you can safely upgrade to
360− nextcloud19. If not, please upgrade to nextcloud18 first since Nextcloud doesn't
361− support upgrades that skip multiple versions (i.e. an upgrade from 17 to 19 isn't
362− possible, but an upgrade from 18 to 19).
363− '');
352+ ++ (optional (versionOlder cfg.package.version "18") (upgradeWarning 17 "20.03"))
353+ ++ (optional (versionOlder cfg.package.version "19") (upgradeWarning 18 "20.09"))
354+ ++ (optional (versionOlder cfg.package.version "20") (upgradeWarning 19 "21.03"));
364355
365356 services.nextcloud.package = with pkgs;
366357 mkDefault (
@@ -372,7 +363,8 @@ in {
372363 ''
373364 else if versionOlder stateVersion "20.03" then nextcloud17
374365 else if versionOlder stateVersion "20.09" then nextcloud18
375− else nextcloud19
366+ else if versionOlder stateVersion "21.03" then nextcloud19
367+ else nextcloud20
376368 );
377369 }
378370
@@ -435,7 +427,7 @@ in {
435427 then ''"$(<"${toString c.dbpassFile}")"''
436428 else if c.dbpass != null
437429 then ''"${toString c.dbpass}"''
438− else null;
430+ else ''""'';
439431 adminpass = if c.adminpassFile != null
440432 then ''"$(<"${toString c.adminpassFile}")"''
441433 else ''"${toString c.adminpass}"'';
@@ -449,8 +441,7 @@ in {
449441 ${if c.dbhost != null then "--database-host" else null} = ''"${c.dbhost}"'';
450442 ${if c.dbport != null then "--database-port" else null} = ''"${toString c.dbport}"'';
451443 ${if c.dbuser != null then "--database-user" else null} = ''"${c.dbuser}"'';
452− ${if (any (x: x != null) [c.dbpass c.dbpassFile])
453− then "--database-pass" else null} = dbpass;
444+ "--database-pass" = dbpass;
454445 ${if c.dbtableprefix != null
455446 then "--database-table-prefix" else null} = ''"${toString c.dbtableprefix}"'';
456447 "--admin-user" = ''"${c.adminuser}"'';
@@ -543,9 +534,9 @@ in {
543534
544535 services.nginx.enable = mkDefault true;
545536
546− # FIXME(ma27) make sure that the config works fine with Nextcloud 19
547− # *and* Nextcloud 20 as soon as it gets released.
548− services.nginx.virtualHosts.${cfg.hostName} = {
537+ services.nginx.virtualHosts.${cfg.hostName} = let
538+ major = toInt (versions.major cfg.package.version);
539+ in {
549540 root = cfg.package;
550541 locations = {
551542 "= /robots.txt" = {
@@ -558,7 +549,9 @@ in {
558549 };
559550 "/" = {
560551 priority = 900;
561− extraConfig = "rewrite ^ /index.php;";
552+ extraConfig = if major < 20
553+ then "rewrite ^ /index.php;"
554+ else "try_files $uri $uri/ /index.php$request_uri;";
562555 };
563556 "~ ^/store-apps" = {
564557 priority = 201;
@@ -582,7 +575,7 @@ in {
582575 "~ ^/(?:\\.|autotest|occ|issue|indie|db_|console)".extraConfig = ''
583576 return 404;
584577 '';
585− "~ ^\\/(?:index|remote|public|cron|core\\/ajax\\/update|status|ocs\\/v[12]|updater\\/.+|oc[ms]-provider\\/.+|.+\\/richdocumentscode\\/proxy)\\.php(?:$|\\/)" = {
578+ ${if major < 20 then "~ ^\\/(?:index|remote|public|cron|core\\/ajax\\/update|status|ocs\\/v[12]|updater\\/.+|oc[ms]-provider\\/.+|.+\\/richdocumentscode\\/proxy)\\.php(?:$|\\/)" else "~ \\.php(?:$|/)"} = {
586579 priority = 500;
587580 extraConfig = ''
588581 include ${config.services.nginx.package}/conf/fastcgi.conf;
pkgs/servers/nextcloud/default.nix+5
@@ -49,4 +49,9 @@ in {
4949 version = "19.0.3";
5050 sha256 = "0sc9cnsdh8kj60h7i3knh40ngdz1w1wmdqw2v2axfkmax22kjl7w";
5151 };
52+
53+ nextcloud20 = generic {
54+ version = "20.0.0";
55+ sha256 = "1n2cv1i56g6qpzkbl5xaf420zzr4y7isg0lskmr7ymk83way0wx2";
56+ };
5257}
pkgs/top-level/all-packages.nix+1−1
@@ -5715,7 +5715,7 @@ in
57155715 grocy = callPackage ../servers/grocy { };
57165716
57175717 inherit (callPackage ../servers/nextcloud {})
5718− nextcloud17 nextcloud18 nextcloud19;
5718+ nextcloud17 nextcloud18 nextcloud19 nextcloud20;
57195719
57205720 nextcloud-client = libsForQt514.callPackage ../applications/networking/nextcloud-client { };
57215721