From 4f6e190002467017154f49f6598f0190d98657f3 Mon Sep 17 00:00:00 2001 From: "P. R. d. O" Date: Tue, 7 Feb 2023 13:48:25 -0600 Subject: [PATCH] pocket-casts: build from source --- .../audio/pocket-casts/default.nix | 66 ++++++++++--------- pkgs/top-level/all-packages.nix | 4 +- 2 files changed, 37 insertions(+), 33 deletions(-) diff --git a/pkgs/applications/audio/pocket-casts/default.nix b/pkgs/applications/audio/pocket-casts/default.nix index 528cc18cbe46..576124d96844 100644 --- a/pkgs/applications/audio/pocket-casts/default.nix +++ b/pkgs/applications/audio/pocket-casts/default.nix @@ -1,57 +1,59 @@ -{ lib, stdenv, fetchurl, dpkg, autoPatchelfHook, makeWrapper, electron -, alsa-lib, gtk3, libXScrnSaver, libXtst, mesa, nss }: +{ lib +, stdenv +, fetchFromGitHub +, electron +, copyDesktopItems +, makeDesktopItem +, makeWrapper +}: stdenv.mkDerivation rec { pname = "pocket-casts"; version = "0.6.0"; - src = fetchurl { - url = "https://github.com/felicianotech/pocket-casts-desktop-app/releases/download/v${version}/${pname}_${version}_amd64.deb"; - sha256 = "sha256-nHdF9RDOkM9HwwmK/axiIPM4nmKrWp/FHNC/EI1vTTc="; + src = fetchFromGitHub { + owner = "felicianotech"; + repo = "pocket-casts-desktop-app"; + rev = "v${version}"; + sha256 = "sha256-WMv2G4b7kYnWy0pz8YyI2eTdefs1mtWau+HQLiRygjE="; }; - nativeBuildInputs = [ - dpkg - autoPatchelfHook - makeWrapper + desktopItems = [ + (makeDesktopItem { + name = pname; + desktopName = "Pocket Casts"; + genericName = "Podcasts Listener"; + exec = "pocket-casts"; + icon = "pocket-casts"; + comment = meta.description; + }) ]; - buildInputs = [ alsa-lib gtk3 libXScrnSaver libXtst mesa nss ]; - - unpackCmd = '' - # If unpacking using -x option, there is a permission error - dpkg-deb --fsys-tarfile $src | tar -x --no-same-permissions --no-same-owner; - ''; + nativeBuildInputs = [ + copyDesktopItems + makeWrapper + ]; installPhase = '' runHook preInstall - mkdir -p $out - mv bin $out - mv lib $out - mv share $out + mkdir -p $out/bin $out/opt/pocket-casts $out/share/pixmaps - cp $out/lib/pocket-casts/resources/app/icon.png $out/share/pixmaps/pocket-casts.png + cp -r main.js tray-icon.png LICENSE $out/opt/pocket-casts + install -Dm644 icon.png $out/share/pixmaps/pocket-casts.png + install -Dm644 icon-x360.png $out/share/pixmaps/pocket-casts-x360.png + + makeWrapper ${electron}/bin/electron $out/bin/pocket-casts \ + --add-flags $out/opt/pocket-casts/main.js runHook postInstall ''; - postFixup = '' - substituteInPlace $out/share/applications/pocket-casts.desktop \ - --replace Name=pocket-casts "Name=Pocket Casts" \ - --replace GenericName=pocket-casts "GenericName=Podcasts App" \ - --replace Exec=pocket-casts Exec=$out/bin/pocket-casts - makeWrapper ${electron}/bin/electron \ - $out/bin/pocket-casts \ - --add-flags $out/lib/pocket-casts/resources/app/main.js - ''; - meta = with lib; { description = "Pocket Casts webapp, packaged for the Linux Desktop"; homepage = "https://github.com/felicianotech/pocket-casts-desktop-app"; - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; license = licenses.mit; maintainers = with maintainers; [ wolfangaukang ]; - platforms = [ "x86_64-linux" ]; + platforms = platforms.linux; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e2ff22c0ad24..8e2d382ae4dd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5378,7 +5378,9 @@ with pkgs; pn = callPackage ../tools/text/pn { }; - pocket-casts = callPackage ../applications/audio/pocket-casts { }; + pocket-casts = callPackage ../applications/audio/pocket-casts { + electron = electron_22; + }; pouf = callPackage ../tools/misc/pouf { };