2020-06-20 19:04:26 +02:00
|
|
|
# Even though pCloud Drive is redistributed as a plug-n-play AppImage, it
|
|
|
|
# requires a little bit more love because of the way Nix launches those types
|
|
|
|
# of applications.
|
|
|
|
#
|
|
|
|
# What Nix does, simplifying a bit, is that it extracts an AppImage and starts
|
|
|
|
# it via buildFHSUserEnv - this is totally fine for majority of apps, but makes
|
|
|
|
# it by-design *impossible* to launch SUID wrappers [^1]; in case of pCloud,
|
|
|
|
# it's fusermount.
|
|
|
|
# (so pCloud starts, but silently fails to mount the FUSE drive.)
|
|
|
|
#
|
|
|
|
# To overcome this issue, we're manually extracting the AppImage and then treat
|
|
|
|
# it as if it was a regular, good-ol' application requiring some standard path
|
|
|
|
# fixes.
|
|
|
|
#
|
|
|
|
# ^1 https://github.com/NixOS/nixpkgs/issues/69338
|
|
|
|
|
|
|
|
{
|
2021-07-27 13:52:39 +02:00
|
|
|
# Build dependencies
|
|
|
|
appimageTools, autoPatchelfHook, fetchzip, lib, stdenv
|
2020-06-20 19:04:26 +02:00
|
|
|
|
2021-07-27 13:52:39 +02:00
|
|
|
# Runtime dependencies;
|
|
|
|
# A few additional ones (e.g. Node) are already shipped together with the
|
|
|
|
# AppImage, so we don't have to duplicate them here.
|
|
|
|
, alsa-lib, dbus-glib, fuse, gnome, gsettings-desktop-schemas, gtk3, libdbusmenu-gtk2, libXdamage, nss, udev
|
2020-06-20 19:04:26 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = "pcloud";
|
2021-09-30 10:34:16 +02:00
|
|
|
version = "1.9.7";
|
|
|
|
code = "XZ0FAtXZNxFJbda6KhLejU9tKAg4N0TEqx3V";
|
2020-06-20 19:04:26 +02:00
|
|
|
|
|
|
|
# Archive link's code thanks to: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=pcloud-drive
|
|
|
|
src = fetchzip {
|
2021-07-12 12:51:53 +02:00
|
|
|
url = "https://api.pcloud.com/getpubzip?code=${code}&filename=${pname}-${version}.zip";
|
2021-09-30 10:34:16 +02:00
|
|
|
hash = "sha256-6eMRFuZOLcoZd2hGw7QV+kAmzE5lK8uK6ZpGs4n7/zw=";
|
2020-06-20 19:04:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
appimageContents = appimageTools.extractType2 {
|
2021-07-12 12:51:53 +02:00
|
|
|
name = "${pname}-${version}";
|
2020-06-20 19:04:26 +02:00
|
|
|
src = "${src}/pcloud";
|
|
|
|
};
|
|
|
|
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
inherit pname version;
|
|
|
|
|
|
|
|
src = appimageContents;
|
|
|
|
|
|
|
|
dontConfigure = true;
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
autoPatchelfHook
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2021-06-10 04:57:09 +02:00
|
|
|
alsa-lib
|
2020-06-20 19:04:26 +02:00
|
|
|
dbus-glib
|
|
|
|
fuse
|
2021-03-16 22:00:50 +01:00
|
|
|
gtk3
|
2020-06-20 19:04:26 +02:00
|
|
|
libdbusmenu-gtk2
|
2021-05-02 15:16:04 +02:00
|
|
|
libXdamage
|
2020-06-20 19:04:26 +02:00
|
|
|
nss
|
|
|
|
udev
|
|
|
|
];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir "$out"
|
|
|
|
cp -ar . "$out/app"
|
|
|
|
cd "$out"
|
|
|
|
|
|
|
|
# Remove the AppImage runner, since users are not supposed to use it; the
|
|
|
|
# actual entry point is the `pcloud` binary
|
|
|
|
rm app/AppRun
|
|
|
|
|
|
|
|
# Adjust directory structure, so that the `.desktop` etc. files are
|
|
|
|
# properly detected
|
|
|
|
mkdir bin
|
|
|
|
mv app/usr/share .
|
|
|
|
mv app/usr/lib .
|
|
|
|
|
|
|
|
# Adjust the `.desktop` file
|
|
|
|
mkdir share/applications
|
|
|
|
|
|
|
|
substitute \
|
|
|
|
app/pcloud.desktop \
|
|
|
|
share/applications/pcloud.desktop \
|
2021-04-17 12:38:37 +02:00
|
|
|
--replace 'Name=pcloud' 'Name=pCloud' \
|
|
|
|
--replace 'Exec=AppRun' 'Exec=${pname}'
|
2020-06-20 19:04:26 +02:00
|
|
|
|
|
|
|
# Build the main executable
|
|
|
|
cat > bin/pcloud <<EOF
|
|
|
|
#! $SHELL -e
|
|
|
|
|
|
|
|
# This is required for the file picker dialog - otherwise pcloud just
|
|
|
|
# crashes
|
2021-07-27 13:52:39 +02:00
|
|
|
export XDG_DATA_DIRS="${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}:$XDG_DATA_DIRS"
|
2020-06-20 19:04:26 +02:00
|
|
|
|
|
|
|
exec "$out/app/pcloud"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
chmod +x bin/pcloud
|
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2020-06-20 19:04:26 +02:00
|
|
|
description = "Secure and simple to use cloud storage for your files; pCloud Drive, Electron Edition";
|
|
|
|
homepage = "https://www.pcloud.com/";
|
|
|
|
license = licenses.unfree;
|
|
|
|
maintainers = with maintainers; [ patryk27 ];
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
};
|
|
|
|
}
|