lol
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 22.05-pre 111 lines 3.2 kB view raw
1# Even though pCloud Drive is redistributed as a plug-n-play AppImage, it 2# requires a little bit more love because of the way Nix launches those types 3# of applications. 4# 5# What Nix does, simplifying a bit, is that it extracts an AppImage and starts 6# it via buildFHSUserEnv - this is totally fine for majority of apps, but makes 7# it by-design *impossible* to launch SUID wrappers [^1]; in case of pCloud, 8# it's fusermount. 9# (so pCloud starts, but silently fails to mount the FUSE drive.) 10# 11# To overcome this issue, we're manually extracting the AppImage and then treat 12# it as if it was a regular, good-ol' application requiring some standard path 13# fixes. 14# 15# ^1 https://github.com/NixOS/nixpkgs/issues/69338 16 17{ 18 # Build dependencies 19 appimageTools, autoPatchelfHook, fetchzip, lib, stdenv 20 21 # Runtime dependencies; 22 # A few additional ones (e.g. Node) are already shipped together with the 23 # AppImage, so we don't have to duplicate them here. 24, alsa-lib, dbus-glib, fuse, gnome, gsettings-desktop-schemas, gtk3, libdbusmenu-gtk2, libXdamage, nss, udev 25}: 26 27let 28 pname = "pcloud"; 29 version = "1.9.7"; 30 code = "XZ0FAtXZNxFJbda6KhLejU9tKAg4N0TEqx3V"; 31 32 # Archive link's code thanks to: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=pcloud-drive 33 src = fetchzip { 34 url = "https://api.pcloud.com/getpubzip?code=${code}&filename=${pname}-${version}.zip"; 35 hash = "sha256-6eMRFuZOLcoZd2hGw7QV+kAmzE5lK8uK6ZpGs4n7/zw="; 36 }; 37 38 appimageContents = appimageTools.extractType2 { 39 name = "${pname}-${version}"; 40 src = "${src}/pcloud"; 41 }; 42 43in stdenv.mkDerivation { 44 inherit pname version; 45 46 src = appimageContents; 47 48 dontConfigure = true; 49 dontBuild = true; 50 51 nativeBuildInputs = [ 52 autoPatchelfHook 53 ]; 54 55 buildInputs = [ 56 alsa-lib 57 dbus-glib 58 fuse 59 gtk3 60 libdbusmenu-gtk2 61 libXdamage 62 nss 63 udev 64 ]; 65 66 installPhase = '' 67 mkdir "$out" 68 cp -ar . "$out/app" 69 cd "$out" 70 71 # Remove the AppImage runner, since users are not supposed to use it; the 72 # actual entry point is the `pcloud` binary 73 rm app/AppRun 74 75 # Adjust directory structure, so that the `.desktop` etc. files are 76 # properly detected 77 mkdir bin 78 mv app/usr/share . 79 mv app/usr/lib . 80 81 # Adjust the `.desktop` file 82 mkdir share/applications 83 84 substitute \ 85 app/pcloud.desktop \ 86 share/applications/pcloud.desktop \ 87 --replace 'Name=pcloud' 'Name=pCloud' \ 88 --replace 'Exec=AppRun' 'Exec=${pname}' 89 90 # Build the main executable 91 cat > bin/pcloud <<EOF 92 #! $SHELL -e 93 94 # This is required for the file picker dialog - otherwise pcloud just 95 # crashes 96 export XDG_DATA_DIRS="${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}:$XDG_DATA_DIRS" 97 98 exec "$out/app/pcloud" 99 EOF 100 101 chmod +x bin/pcloud 102 ''; 103 104 meta = with lib; { 105 description = "Secure and simple to use cloud storage for your files; pCloud Drive, Electron Edition"; 106 homepage = "https://www.pcloud.com/"; 107 license = licenses.unfree; 108 maintainers = with maintainers; [ patryk27 ]; 109 platforms = [ "x86_64-linux" ]; 110 }; 111}