about summary refs log tree commit diff
path: root/pkgs/applications/audio/pocket-casts/default.nix
blob: 528cc18cbe46cbaf88e3a0c3f6cb695d5a95e201 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{ lib, stdenv, fetchurl, dpkg, autoPatchelfHook, makeWrapper, electron
, alsa-lib, gtk3, libXScrnSaver, libXtst, mesa, nss }:

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=";
  };

  nativeBuildInputs = [
    dpkg
    autoPatchelfHook
    makeWrapper
  ];

  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;
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out
    mv bin $out
    mv lib $out
    mv share $out

    cp $out/lib/pocket-casts/resources/app/icon.png $out/share/pixmaps/pocket-casts.png

    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" ];
  };
}