aboutsummaryrefslogtreecommitdiff
path: root/pkgs/webapps/nextcloud/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/webapps/nextcloud/default.nix')
-rw-r--r--pkgs/webapps/nextcloud/default.nix60
1 files changed, 32 insertions, 28 deletions
diff --git a/pkgs/webapps/nextcloud/default.nix b/pkgs/webapps/nextcloud/default.nix
index 2d4eb39..fecb3a7 100644
--- a/pkgs/webapps/nextcloud/default.nix
+++ b/pkgs/webapps/nextcloud/default.nix
@@ -1,5 +1,13 @@
1{ varDir ? "/var/lib/nextcloud", otherConfig ? {}, lib, stdenv, fetchurl }: 1{ varDir ? "/var/lib/nextcloud", nextcloudVersion ? 17, otherConfig ? {}, lib, stdenv, callPackage, fetchurl }:
2let 2let
3 appNames = [
4 "apporder" "audioplayer" "bookmarks" "calendar" "carnet" "contacts"
5 "cookbook" "deck" "extract" "files_markdown" "files_readmemd"
6 "flowupload" "gpxedit" "gpxpod" "keeweb" "maps" "metadata" "music"
7 "notes" "ocsms" "passman" "polls" "spreed" "tasks"
8 ];
9 allApps = lib.attrsets.genAttrs appNames
10 (name: callPackage (./apps + "/${name}.nix") { inherit buildApp nextcloudVersion; });
3 buildApp = { appName, version, url, sha256, otherConfig ? {}, installPhase ? "mkdir -p $out && cp -R . $out/" }: 11 buildApp = { appName, version, url, sha256, otherConfig ? {}, installPhase ? "mkdir -p $out && cp -R . $out/" }:
4 stdenv.mkDerivation rec { 12 stdenv.mkDerivation rec {
5 name = "nextcloud-app-${appName}-${version}"; 13 name = "nextcloud-app-${appName}-${version}";
@@ -11,34 +19,33 @@ let
11 inherit appName otherConfig; 19 inherit appName otherConfig;
12 }; 20 };
13 }; 21 };
14 withApps = apps: package.overrideAttrs(old: { 22 toPassthru = pkg: apps: otherConfig: {
15 name = "${old.name}-with-apps"; 23 inherit apps otherConfig allApps buildApp varDir;
16 24 withApps = withApps pkg;
17 installPhase = old.installPhase + ( 25 };
18 builtins.concatStringsSep "\n" ( 26 withApps = pkg: toApps:
19 map (value: "ln -sf ${value} $out/apps/${value.appName}") apps 27 let
20 )); 28 apps = toApps allApps;
21 29 toInstallApp = n: ''
22 passthru = old.passthru // { 30 ln -sf ${n} $out/apps/${n.appName}
23 otherConfig = with lib.attrsets; with lib.lists; let 31 '';
24 zipped = zipAttrs ([old.otherConfig or {}] ++ map (v: v.otherConfig) apps); 32 zipped = lib.attrsets.zipAttrs ([pkg.otherConfig or {}] ++ map (v: v.otherConfig) apps);
25 in 33 appConfigs = with lib.attrsets; with lib.lists; {
26 { 34 mimetypealiases = foldr (h: prev: prev // h) {} (zipped.mimetypealiases or []);
27 mimetypealiases = foldr (h: prev: prev // h) {} zipped.mimetypealiases; 35 mimetypemapping = mapAttrs (_: v: unique (flatten v)) (zipAttrs (zipped.mimetypemapping or []));
28 mimetypemapping = mapAttrs (_: v: unique (flatten v)) (zipAttrs zipped.mimetypemapping); 36 };
29 }; 37 newNextcloud = pkg.overrideAttrs(old: {
30 inherit apps; 38 installPhase = old.installPhase + "\n" + builtins.concatStringsSep "\n" (map toInstallApp apps);
31 withApps = moreApps: old.withApps (moreApps ++ apps); 39 passthru = toPassthru newNextcloud (pkg.apps ++ apps) appConfigs;
32 }; 40 });
33 }); 41 in newNextcloud;
34
35 package = stdenv.mkDerivation rec { 42 package = stdenv.mkDerivation rec {
36 name = "nextcloud-${version}"; 43 name = "nextcloud-${version}";
37 version = "16.0.0"; 44 version = "${builtins.toString nextcloudVersion}.0.6";
38 45
39 src = fetchurl { 46 src = fetchurl {
40 url = "https://download.nextcloud.com/server/releases/${name}.tar.bz2"; 47 url = "https://download.nextcloud.com/server/releases/${name}.tar.bz2";
41 sha256 = "0bj014vczlrql1w32pqmr7cyqn9awnyzpi2syxhg16qxic1gfcj5"; 48 sha256 = "0qq7lkgzsn1zakfym5bjqzpcisxmgfcdd927ddqlhddy3zvgxrxx";
42 }; 49 };
43 50
44 installPhase = '' 51 installPhase = ''
@@ -48,10 +55,7 @@ let
48 ln -sf ${varDir}/config $out/config 55 ln -sf ${varDir}/config $out/config
49 ''; 56 '';
50 57
51 passthru = { 58 passthru = toPassthru package [] otherConfig;
52 apps = [];
53 inherit otherConfig buildApp withApps varDir;
54 };
55 meta = { 59 meta = {
56 description = "Sharing solution for files, calendars, contacts and more"; 60 description = "Sharing solution for files, calendars, contacts and more";
57 homepage = https://nextcloud.com; 61 homepage = https://nextcloud.com;