about summary refs log tree commit diff
path: root/pkgs/build-support/fetchnextcloudapp
diff options
context:
space:
mode:
authorRobbert Gurdeep Singh <git@beardhatcode.be>2021-09-25 22:19:14 +0200
committerMaximilian Bosch <maximilian@mbosch.me>2021-10-09 20:33:16 +0200
commit18b18929d7537d8acdab7bbd960221b3bc160c6d (patch)
tree7274eaf72ad9a434721aab7c59867f2a2a26fc31 /pkgs/build-support/fetchnextcloudapp
parent7ba02a7b1e6ac86bb0826d65c7f44902f171f4bb (diff)
nixos/nextcloud: add settings to manage nextcloud apps
Note the appstoreEnable which will prevent nextcloud form updating
nix-managed apps. This is needed because nextcloud will store an other
version of the app in /var/lib/nextcloud/store-apps and it will
no longer be manageable.
Diffstat (limited to 'pkgs/build-support/fetchnextcloudapp')
-rw-r--r--pkgs/build-support/fetchnextcloudapp/default.nix38
1 files changed, 38 insertions, 0 deletions
diff --git a/pkgs/build-support/fetchnextcloudapp/default.nix b/pkgs/build-support/fetchnextcloudapp/default.nix
new file mode 100644
index 0000000000000..a7cb5209a7ae1
--- /dev/null
+++ b/pkgs/build-support/fetchnextcloudapp/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, gnutar, findutils, fetchurl, ... }:
+{ name
+, url
+, version
+, sha256
+, patches ? [ ]
+}:
+stdenv.mkDerivation {
+  name = "nc-app-${name}";
+  inherit version patches;
+
+  src = fetchurl {
+    url = url;
+    sha256 = sha256;
+  };
+
+  nativeBuildInputs = [
+    gnutar
+    findutils
+  ];
+
+  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
+  '';
+}