1{ lib, stdenv, fetchurl, nixosTests
2, nextcloud27Packages
3, nextcloud26Packages
4, nextcloud25Packages
5}:
6
7let
8 generic = {
9 version, hash
10 , eol ? false, extraVulnerabilities ? []
11 , packages
12 }: let
13 major = lib.versions.major version;
14 in stdenv.mkDerivation rec {
15 pname = "nextcloud";
16 inherit version;
17
18 src = fetchurl {
19 url = "https://download.nextcloud.com/server/releases/${pname}-${version}.tar.bz2";
20 inherit hash;
21 };
22
23 # This patch is only necessary for NC version <26.
24 patches = lib.optional (lib.versionOlder major "26") (./patches + "/v${major}/0001-Setup-remove-custom-dbuser-creation-behavior.patch");
25
26 passthru = {
27 tests = nixosTests.nextcloud;
28 inherit packages;
29 };
30
31 installPhase = ''
32 runHook preInstall
33 mkdir -p $out/
34 cp -R . $out/
35 runHook postInstall
36 '';
37
38 meta = with lib; {
39 changelog = "https://nextcloud.com/changelog/#${lib.replaceStrings [ "." ] [ "-" ] version}";
40 description = "Sharing solution for files, calendars, contacts and more";
41 homepage = "https://nextcloud.com";
42 maintainers = with maintainers; [ schneefux bachp globin ma27 ];
43 license = licenses.agpl3Plus;
44 platforms = with platforms; unix;
45 knownVulnerabilities = extraVulnerabilities
46 ++ (optional eol "Nextcloud version ${version} is EOL");
47 };
48 };
49in {
50 nextcloud24 = throw ''
51 Nextcloud v24 has been removed from `nixpkgs` as the support for is dropped
52 by upstream in 2023-04. Please upgrade to at least Nextcloud v25 by declaring
53
54 services.nextcloud.package = pkgs.nextcloud25;
55
56 in your NixOS config.
57
58 WARNING: if you were on Nextcloud 23 you have to upgrade to Nextcloud 24
59 first on 22.11 because Nextcloud doesn't support upgrades across multiple major versions!
60 '';
61
62 nextcloud25 = generic {
63 version = "25.0.11";
64 hash = "sha256-UkOCknG6t9uN8ry3dGZ0y7DS3KlQu7mS5K6UO+N+rtE=";
65 packages = nextcloud25Packages;
66 };
67
68 nextcloud26 = generic {
69 version = "26.0.6";
70 hash = "sha256-LKyP2S0kgjDc0Ea7u0RGmyIPWLAQ5j+V2APZhXVer2Y=";
71 packages = nextcloud26Packages;
72 };
73
74 nextcloud27 = generic {
75 version = "27.1.0";
76 hash = "sha256-wxZwWeacUXt64H87sLgyQz0yRnWFkIH+lT6kG8ffEkI=";
77 packages = nextcloud27Packages;
78 };
79
80 # tip: get the sha with:
81 # curl 'https://download.nextcloud.com/server/releases/nextcloud-${version}.tar.bz2.sha256'
82}