summaryrefslogtreecommitdiff
path: root/pkgs/webapps/nextcloud/default.nix
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-12-13 21:25:24 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-24 01:40:13 +0200
commit252dd7d899b7a0deea1537cc5d2d48b825afffb0 (patch)
treef51c3c9cd7429b0b9553a840f26bee489be045bc /pkgs/webapps/nextcloud/default.nix
downloadNUR-nur_root.tar.gz
NUR-nur_root.tar.zst
NUR-nur_root.zip
Initial commit published for NURnur_root
Diffstat (limited to 'pkgs/webapps/nextcloud/default.nix')
-rw-r--r--pkgs/webapps/nextcloud/default.nix63
1 files changed, 63 insertions, 0 deletions
diff --git a/pkgs/webapps/nextcloud/default.nix b/pkgs/webapps/nextcloud/default.nix
new file mode 100644
index 00000000..2d4eb390
--- /dev/null
+++ b/pkgs/webapps/nextcloud/default.nix
@@ -0,0 +1,63 @@
1{ varDir ? "/var/lib/nextcloud", otherConfig ? {}, lib, stdenv, fetchurl }:
2let
3 buildApp = { appName, version, url, sha256, otherConfig ? {}, installPhase ? "mkdir -p $out && cp -R . $out/" }:
4 stdenv.mkDerivation rec {
5 name = "nextcloud-app-${appName}-${version}";
6 inherit version;
7 phases = "unpackPhase installPhase";
8 inherit installPhase;
9 src = fetchurl { inherit url sha256; };
10 passthru = {
11 inherit appName otherConfig;
12 };
13 };
14 withApps = apps: package.overrideAttrs(old: {
15 name = "${old.name}-with-apps";
16
17 installPhase = old.installPhase + (
18 builtins.concatStringsSep "\n" (
19 map (value: "ln -sf ${value} $out/apps/${value.appName}") apps
20 ));
21
22 passthru = old.passthru // {
23 otherConfig = with lib.attrsets; with lib.lists; let
24 zipped = zipAttrs ([old.otherConfig or {}] ++ map (v: v.otherConfig) apps);
25 in
26 {
27 mimetypealiases = foldr (h: prev: prev // h) {} zipped.mimetypealiases;
28 mimetypemapping = mapAttrs (_: v: unique (flatten v)) (zipAttrs zipped.mimetypemapping);
29 };
30 inherit apps;
31 withApps = moreApps: old.withApps (moreApps ++ apps);
32 };
33 });
34
35 package = stdenv.mkDerivation rec {
36 name = "nextcloud-${version}";
37 version = "16.0.0";
38
39 src = fetchurl {
40 url = "https://download.nextcloud.com/server/releases/${name}.tar.bz2";
41 sha256 = "0bj014vczlrql1w32pqmr7cyqn9awnyzpi2syxhg16qxic1gfcj5";
42 };
43
44 installPhase = ''
45 mkdir -p $out/
46 cp -R . $out/
47 rm -r $out/config
48 ln -sf ${varDir}/config $out/config
49 '';
50
51 passthru = {
52 apps = [];
53 inherit otherConfig buildApp withApps varDir;
54 };
55 meta = {
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;
61 };
62 };
63in package