1 { varDir ? "/var/lib/nextcloud", otherConfig ? {}, lib, stdenv, fetchurl }:
3 buildApp = { appName, version, url, sha256, otherConfig ? {}, installPhase ? "mkdir -p $out && cp -R . $out/" }:
4 stdenv.mkDerivation rec {
5 name = "nextcloud-app-${appName}-${version}";
7 phases = "unpackPhase installPhase";
9 src = fetchurl { inherit url sha256; };
11 inherit appName otherConfig;
14 withApps = apps: package.overrideAttrs(old: {
15 name = "${old.name}-with-apps";
17 installPhase = old.installPhase + (
18 builtins.concatStringsSep "\n" (
19 map (value: "ln -sf ${value} $out/apps/${value.appName}") apps
22 passthru = old.passthru // {
23 otherConfig = with lib.attrsets; with lib.lists; let
24 zipped = zipAttrs ([old.otherConfig or {}] ++ map (v: v.otherConfig) apps);
27 mimetypealiases = foldr (h: prev: prev // h) {} zipped.mimetypealiases;
28 mimetypemapping = mapAttrs (_: v: unique (flatten v)) (zipAttrs zipped.mimetypemapping);
31 withApps = moreApps: old.withApps (moreApps ++ apps);
35 package = stdenv.mkDerivation rec {
36 name = "nextcloud-${version}";
40 url = "https://download.nextcloud.com/server/releases/${name}.tar.bz2";
41 sha256 = "0bj014vczlrql1w32pqmr7cyqn9awnyzpi2syxhg16qxic1gfcj5";
48 ln -sf ${varDir}/config $out/config
53 inherit otherConfig buildApp withApps varDir;
56 description = "Sharing solution for files, calendars, contacts and more";
57 homepage = https://nextcloud.com;
58 maintainers = with lib.maintainers; [ schneefux bachp globin fpletz ];
59 license = lib.licenses.agpl3Plus;
60 platforms = with lib.platforms; unix;