1{
2 lib,
3 stdenvNoCC,
4 fetchurl,
5 nixosTests,
6 cacert,
7 caBundle ? "${cacert}/etc/ssl/certs/ca-bundle.crt",
8 nextcloud30Packages,
9 nextcloud31Packages,
10}:
11
12let
13 generic =
14 {
15 version,
16 hash,
17 eol ? false,
18 extraVulnerabilities ? [ ],
19 packages,
20 }:
21 stdenvNoCC.mkDerivation rec {
22 pname = "nextcloud";
23 inherit version;
24
25 src = fetchurl {
26 url = "https://download.nextcloud.com/server/releases/nextcloud-${version}.tar.bz2";
27 inherit hash;
28 };
29
30 passthru = {
31 tests = lib.filterAttrs (
32 key: _: (lib.hasSuffix (lib.versions.major version) key)
33 ) nixosTests.nextcloud;
34 inherit packages;
35 };
36
37 postPatch = ''
38 cp ${caBundle} resources/config/ca-bundle.crt
39 '';
40
41 installPhase = ''
42 runHook preInstall
43 mkdir -p $out/
44 cp -R . $out/
45 runHook postInstall
46 '';
47
48 meta = {
49 changelog = "https://nextcloud.com/changelog/#${lib.replaceStrings [ "." ] [ "-" ] version}";
50 description = "Sharing solution for files, calendars, contacts and more";
51 homepage = "https://nextcloud.com";
52 teams = [ lib.teams.nextcloud ];
53 license = lib.licenses.agpl3Plus;
54 platforms = lib.platforms.linux;
55 knownVulnerabilities =
56 extraVulnerabilities ++ (lib.optional eol "Nextcloud version ${version} is EOL");
57 };
58 };
59in
60{
61 nextcloud30 = generic {
62 version = "30.0.13";
63 hash = "sha256-viMmo689YHK08Uza05O5Y3qj3EDK9W/TgXXuo6j/j4Y=";
64 packages = nextcloud30Packages;
65 };
66
67 nextcloud31 = generic {
68 version = "31.0.7";
69 hash = "sha256-ACpdA64Fp/DDBWlH1toLeaRNPXIPVyj+UVWgxaO07Gk=";
70 packages = nextcloud31Packages;
71 };
72
73 # tip: get the sha with:
74 # curl 'https://download.nextcloud.com/server/releases/nextcloud-${version}.tar.bz2.sha256'
75}