Unverified Commit 9ec7bb2e authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

pcloud: 1.14.18 -> 2.0.3 (#492761)

parents 77c514cc afa5b77a
Loading
Loading
Loading
Loading
+25 −19
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
  gsettings-desktop-schemas,
  gtk3,
  libdbusmenu-gtk2,
  libgbm,
  libxdamage,
  nss,
  udev,
@@ -39,25 +40,24 @@

let
  pname = "pcloud";
  version = "1.14.18";
  code = "XZ2gJM5Z8pdJVlCT0s5FI1aTKxxgt48aEr8k";
  version = "2.0.3";
  code = "XZ8opl5ZaaYsnBeCX3fLU3v8ngqAv8VMqq7k";

  # Archive link's codes: https://www.pcloud.com/release-notes/linux.html
  src = fetchzip {
    url = "https://api.pcloud.com/getpubzip?code=${code}&filename=pcloud-${version}.zip";
    hash = "sha256-YDXmna1SZaDLK1EEdHvWm9+PgYKjYUsa2lvdzFGmyIU=";
  };

  appimageContents = appimageTools.extractType2 {
    inherit pname version;
    src = "${src}/pcloud";
    hash = "sha256-Few8BsMUwL5qfdtFyezoWifZcZufAhUthxQXEQwm52w=";
  };

in
stdenv.mkDerivation {
  inherit pname version;

  src = appimageContents;
  src = appimageTools.extractType2 {
    inherit pname version;

    src = "${src}/pCloud.AppImage";
  };

  dontConfigure = true;
  dontBuild = true;
@@ -73,6 +73,7 @@ stdenv.mkDerivation {
    fuse
    gtk3
    libdbusmenu-gtk2
    libgbm
    libxdamage
    nss
    udev
@@ -83,12 +84,17 @@ stdenv.mkDerivation {
    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
    # Remove AppImage runner, users are not supposed to use it - `pcloud` binary
    # itself is the correct entrypoint
    rm app/AppRun

    # Adjust directory structure, so that the `.desktop` etc. files are
    # properly detected
    # Remove random stuff that causes patchelf to complain about missing deps
    # that are not, in fact, missing deps, because those files don't get
    # executed in the first place
    rm app/resources/app.asar.unpacked/node_modules/koffi/build/koffi/musl_x64/koffi.node
    rm app/resources/app.asar.unpacked/node_modules/koffi/build/koffi/openbsd_x64/koffi.node

    # Adjust the directory structure, so that `.desktop` etc. files are detected
    mkdir bin
    mv app/usr/share .
    mv app/usr/lib .
@@ -99,23 +105,23 @@ stdenv.mkDerivation {
    substitute \
      app/pcloud.desktop \
      share/applications/pcloud.desktop \
      --replace 'Name=pcloud' 'Name=pCloud' \
      --replace 'Exec=AppRun' 'Exec=${pname}'

    # Build the main executable
    # Adjust the icons
    ln -snf $out/share/icons/hicolor/512x512/apps/pcloud.png app/.DirIcon
    ln -snf $out/share/icons/hicolor/512x512/apps/pcloud.png app/pcloud.png

    # Build the entrypoint
    cat > bin/pcloud <<EOF
    #! $SHELL -e

    # This is required for the file picker dialog - otherwise pcloud just
    # crashes
    # Required for the file picker dialog - otherwise pcloud crashes
    export XDG_DATA_DIRS="${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}:$XDG_DATA_DIRS"

    exec "$out/app/pcloud"
    EOF

    chmod +x bin/pcloud

    ln -snf $out/share/icons/hicolor/512x512/apps/pcloud.png $out/app/pcloud.png
  '';

  meta = {