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