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