about summary refs log tree commit diff
path: root/pkgs/by-name
diff options
context:
space:
mode:
authorNick Cao <nickcao@nichi.co>2024-02-11 12:50:15 -0500
committerGitHub <noreply@github.com>2024-02-11 12:50:15 -0500
commit6f49991ae3bb701fb18ebdd48d88392192efe965 (patch)
treeee05eeaea0d1621ff5c66db64e25c46fdb6dffcd /pkgs/by-name
parent463d2fed6beccd7e75fef49c8353c582770a088e (diff)
parentc3997c9525ed62c4cf4195e5ca27440a083476d5 (diff)
downloadnixlib-6f49991ae3bb701fb18ebdd48d88392192efe965.tar
nixlib-6f49991ae3bb701fb18ebdd48d88392192efe965.tar.gz
nixlib-6f49991ae3bb701fb18ebdd48d88392192efe965.tar.bz2
nixlib-6f49991ae3bb701fb18ebdd48d88392192efe965.tar.lz
nixlib-6f49991ae3bb701fb18ebdd48d88392192efe965.tar.xz
nixlib-6f49991ae3bb701fb18ebdd48d88392192efe965.tar.zst
nixlib-6f49991ae3bb701fb18ebdd48d88392192efe965.zip
Merge pull request #287835 from onny/poopcorn
popcorntime: 0.4.9 -> 0.5.0
Diffstat (limited to 'pkgs/by-name')
-rw-r--r--pkgs/by-name/po/popcorntime/package.nix94
1 files changed, 94 insertions, 0 deletions
diff --git a/pkgs/by-name/po/popcorntime/package.nix b/pkgs/by-name/po/popcorntime/package.nix
new file mode 100644
index 000000000000..240836d60049
--- /dev/null
+++ b/pkgs/by-name/po/popcorntime/package.nix
@@ -0,0 +1,94 @@
+{ autoPatchelfHook
+, fetchurl
+, gcc-unwrapped
+, gsettings-desktop-schemas
+, gtk3
+, lib
+, makeDesktopItem
+, makeWrapper
+, nwjs
+, stdenv
+, unzip
+, udev
+, wrapGAppsHook
+, copyDesktopItems
+}:
+
+stdenv.mkDerivation rec {
+  pname = "popcorntime";
+  version = "0.5.0";
+
+  src = fetchurl {
+    url = "https://github.com/popcorn-official/popcorn-desktop/releases/download/v${version}/Popcorn-Time-${version}-linux64.zip";
+    hash = "sha256-A5G66KkCQ1AiOOO02dZFAVz6dqvComrd5lXQ4Wc1S0s=";
+  };
+
+  nativeBuildInputs = [
+    autoPatchelfHook
+    makeWrapper
+    unzip
+    wrapGAppsHook
+    copyDesktopItems
+  ];
+
+  buildInputs = [
+    gcc-unwrapped
+    gsettings-desktop-schemas
+    gtk3
+    nwjs
+    udev
+  ];
+
+  sourceRoot = ".";
+
+  dontWrapGApps = true;
+  dontUnpack = true;
+
+  makeWrapperArgs = [
+    "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ gcc-unwrapped.lib gtk3 udev ]}"
+    "--prefix PATH : ${lib.makeBinPath [ stdenv.cc ]}"
+  ];
+
+  desktopItem = makeDesktopItem {
+      name = pname;
+      exec = pname;
+      icon = pname;
+      comment = meta.description;
+      genericName = meta.description;
+      type = "Application";
+      desktopName = "Popcorn-Time";
+      categories = [ "Video" "AudioVideo" ];
+    };
+
+  # Extract and copy executable in $out/bin
+  installPhase = ''
+    mkdir -p $out/share/applications $out/bin $out/opt/bin $out/share/icons/hicolor/scalable/apps/
+    # we can't unzip it in $out/lib, because nw.js will start with
+    # an empty screen. Therefore it will be unzipped in a non-typical
+    # folder and symlinked.
+    unzip -q $src -d $out/opt/popcorntime
+
+    ln -s $out/opt/popcorntime/Popcorn-Time $out/bin/popcorntime
+
+    ln -s $out/opt/popcorntime/src/app/images/icon.png $out/share/icons/hicolor/scalable/apps/popcorntime.png
+
+    ln -s ${desktopItem}/share/applications/popcorntime.desktop $out/share/applications/popcorntime.desktop
+  '';
+
+  # GSETTINGS_SCHEMAS_PATH is not set in installPhase
+  preFixup = ''
+    wrapProgram $out/bin/popcorntime \
+      ''${makeWrapperArgs[@]} \
+      ''${gappsWrapperArgs[@]}
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/popcorn-official/popcorn-desktop";
+    description = "An application that streams movies and TV shows from torrents";
+    platforms = [ "x86_64-linux" ];
+    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
+    license = lib.licenses.gpl3;
+    maintainers = with maintainers; [ onny ];
+    mainProgram = "popcorntime";
+  };
+}