diff --git a/pkgs/applications/audio/pocket-casts/default.nix b/pkgs/applications/audio/pocket-casts/default.nix index 10bd25e11676..e07904b32485 100644 --- a/pkgs/applications/audio/pocket-casts/default.nix +++ b/pkgs/applications/audio/pocket-casts/default.nix @@ -1,13 +1,13 @@ { lib -, stdenv +, buildNpmPackage , fetchFromGitHub -, electron -, copyDesktopItems , makeDesktopItem +, copyDesktopItems , makeWrapper +, electron }: -stdenv.mkDerivation rec { +buildNpmPackage rec { pname = "pocket-casts"; version = "0.7.0"; @@ -15,9 +15,15 @@ stdenv.mkDerivation rec { owner = "felicianotech"; repo = "pocket-casts-desktop-app"; rev = "v${version}"; - sha256 = "sha256-d4uVeHy4/91Ki6Wk6GlOt2lcK6U+M7fOryiOYA7q/x4="; + hash = "sha256-d4uVeHy4/91Ki6Wk6GlOt2lcK6U+M7fOryiOYA7q/x4="; }; + npmDepsHash = "sha256-rMLUQGcbBJBbxXP67lXp0ww8U2HYM/m1CP2dOw1cCHc="; + + env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; + + dontNpmBuild = true; + desktopItems = [ (makeDesktopItem { name = pname; @@ -34,19 +40,12 @@ stdenv.mkDerivation rec { makeWrapper ]; - installPhase = '' - runHook preInstall - - mkdir -p $out/bin $out/opt/pocket-casts $out/share/pixmaps - - 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 + postInstall = '' + install -Dm644 $out/lib/node_modules/pocket-casts/icon.png $out/share/pixmaps/pocket-casts.png + install -Dm644 $out/lib/node_modules/pocket-casts/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 + --add-flags $out/lib/node_modules/pocket-casts/main.js ''; meta = with lib; { @@ -54,6 +53,7 @@ stdenv.mkDerivation rec { homepage = "https://github.com/felicianotech/pocket-casts-desktop-app"; license = licenses.mit; maintainers = with maintainers; [ wolfangaukang ]; + mainProgram = "pocket-casts"; platforms = platforms.linux; }; }