summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2022-10-16 20:07:57 +0200
committerGitHub <noreply@github.com>2022-10-16 20:07:57 +0200
commita914b9460d467adc289870d414547b468429a96a (patch)
tree0b1a864a032808ab79e334bd5691540c2be538ca /pkgs/build-support
parenta2134c24a4b74d2bbca37e40285a4ae15bd590c9 (diff)
parentd41b381310f5dcde1434b23406532f54ebdeea22 (diff)
Merge pull request #193075 from Ma27/nextcloud-pkg-fix
fetchNextcloudApp: rewrite with fetchzip & applyPatches
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/fetchnextcloudapp/default.nix47
1 files changed, 21 insertions, 26 deletions
diff --git a/pkgs/build-support/fetchnextcloudapp/default.nix b/pkgs/build-support/fetchnextcloudapp/default.nix
index 1997c80c8a153..a7a3066ffab39 100644
--- a/pkgs/build-support/fetchnextcloudapp/default.nix
+++ b/pkgs/build-support/fetchnextcloudapp/default.nix
@@ -1,32 +1,27 @@
-{ stdenv, fetchurl, ... }:
-{ name
-, url
-, version
+{ stdenv, fetchzip, applyPatches, ... }:
+{ url
 , sha256
 , patches ? [ ]
+, name ? null
+, version ? null
 }:
-stdenv.mkDerivation {
-  pname = "nc-app-${name}";
-  inherit version patches;
-
-  src = fetchurl {
+if name != null || version != null then throw ''
+  `pkgs.fetchNextcloudApp` has been changed to use `fetchzip`.
+  To update, please
+  * remove `name`/`version`
+  * update the hash
+''
+else applyPatches {
+  inherit patches;
+  src = fetchzip {
     inherit url sha256;
+    postFetch = ''
+      pushd $out &>/dev/null
+      if [ ! -f ./appinfo/info.xml ]; then
+        echo "appinfo/info.xml doesn't exist in $out, aborting!"
+        exit 1
+      fi
+      popd &>/dev/null
+    '';
   };
-
-  unpackPhase = ''
-    tar -xzpf $src
-  '';
-
-  installPhase = ''
-    approot="$(dirname $(dirname $(find -path '*/appinfo/info.xml' | head -n 1)))"
-
-    if [ -d "$approot" ];
-    then
-      mv "$approot/" $out
-      chmod -R a-w $out
-    else
-      echo "Could not find appinfo/info.xml"
-      exit 1;
-    fi
-  '';
 }