summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorRobert Schütz <nix@dotlambda.de>2022-05-23 06:27:25 +0000
committerRobert Schütz <nix@dotlambda.de>2022-05-23 06:33:24 +0000
commita452e0e2642bf961d03eaa5ce6b2ee8a9725ecee (patch)
tree3ed4070bc93cdad8e2047a348a01030f78aad3e7 /pkgs/applications
parent130bff590ed8266c39a44e3944fd30e28897a8b3 (diff)
downloadnixpkgs-a452e0e2642bf961d03eaa5ce6b2ee8a9725ecee.tar
nixpkgs-a452e0e2642bf961d03eaa5ce6b2ee8a9725ecee.tar.gz
nixpkgs-a452e0e2642bf961d03eaa5ce6b2ee8a9725ecee.tar.bz2
nixpkgs-a452e0e2642bf961d03eaa5ce6b2ee8a9725ecee.tar.lz
nixpkgs-a452e0e2642bf961d03eaa5ce6b2ee8a9725ecee.tar.xz
nixpkgs-a452e0e2642bf961d03eaa5ce6b2ee8a9725ecee.tar.zst
nixpkgs-a452e0e2642bf961d03eaa5ce6b2ee8a9725ecee.zip
hypnotix: init at 2.6
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/video/hypnotix/default.nix86
-rw-r--r--pkgs/applications/video/hypnotix/libmpv-path.patch18
2 files changed, 104 insertions, 0 deletions
diff --git a/pkgs/applications/video/hypnotix/default.nix b/pkgs/applications/video/hypnotix/default.nix
new file mode 100644
index 00000000000..12932280906
--- /dev/null
+++ b/pkgs/applications/video/hypnotix/default.nix
@@ -0,0 +1,86 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, substituteAll
+, cinnamon
+, gettext
+, gobject-introspection
+, mpv
+, python3
+, wrapGAppsHook
+}:
+
+stdenv.mkDerivation rec {
+  pname = "hypnotix";
+  version = "2.6";
+
+  src = fetchFromGitHub {
+    owner = "linuxmint";
+    repo = "hypnotix";
+    rev = version;
+    hash = "sha256-9HWr8zjUuhj/GZdrt1WwpwYNLEl34S9IJ7ikGZBSw3s=";
+  };
+
+  patches = [
+    (substituteAll {
+      src = ./libmpv-path.patch;
+      libmpv = "${lib.getLib mpv}/lib/libmpv${stdenv.hostPlatform.extensions.sharedLibrary}";
+    })
+  ];
+
+  postPatch = ''
+    substituteInPlace usr/lib/hypnotix/hypnotix.py \
+      --replace __DEB_VERSION__ ${version} \
+      --replace /usr/share/hypnotix $out/share/hypnotix
+  '';
+
+  nativeBuildInputs = [
+    gettext
+    gobject-introspection
+    python3.pkgs.wrapPython
+    wrapGAppsHook
+  ];
+
+  dontWrapGApps = true;
+
+  buildInputs = [
+    cinnamon.xapps
+  ];
+
+  pythonPath = with python3.pkgs; [
+    imdbpy
+    pygobject3
+    requests
+    setproctitle
+    unidecode
+    xapp
+  ];
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out
+    cp -r usr/lib $out
+    cp -r usr/share $out
+
+    glib-compile-schemas $out/share/glib-2.0/schemas
+
+    runHook postInstall
+  '';
+
+  preFixup = ''
+    buildPythonPath "$out $pythonPath"
+    makeWrapper ${python3.interpreter} $out/bin/hypnotix \
+      --add-flags $out/lib/hypnotix/hypnotix.py \
+      --prefix PYTHONPATH : "$program_PYTHONPATH" \
+      ''${gappsWrapperArgs[@]}
+  '';
+
+  meta = {
+    description = "IPTV streaming application";
+    homepage = "https://github.com/linuxmint/hypnotix";
+    license = lib.licenses.gpl3Plus;
+    maintainers = with lib.maintainers; [ dotlambda ];
+    platforms = lib.platforms.linux;
+  };
+}
diff --git a/pkgs/applications/video/hypnotix/libmpv-path.patch b/pkgs/applications/video/hypnotix/libmpv-path.patch
new file mode 100644
index 00000000000..86337b4930a
--- /dev/null
+++ b/pkgs/applications/video/hypnotix/libmpv-path.patch
@@ -0,0 +1,18 @@
+diff --git a/usr/lib/hypnotix/mpv.py b/usr/lib/hypnotix/mpv.py
+index f42a3be..f1fc40b 100644
+--- a/usr/lib/hypnotix/mpv.py
++++ b/usr/lib/hypnotix/mpv.py
+@@ -44,12 +44,7 @@ else:
+     # still better than segfaulting, we are setting LC_NUMERIC to "C".
+     locale.setlocale(locale.LC_NUMERIC, 'C')
+ 
+-    sofile = ctypes.util.find_library('mpv')
+-    if sofile is None:
+-        raise OSError("Cannot find libmpv in the usual places. Depending on your distro, you may try installing an "
+-                "mpv-devel or mpv-libs package. If you have libmpv around but this script can't find it, consult "
+-                "the documentation for ctypes.util.find_library which this script uses to look up the library "
+-                "filename.")
++    sofile = '@libmpv@'
+     backend = CDLL(sofile)
+     fs_enc = sys.getfilesystemencoding()
+