summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2022-04-17 08:26:04 +0200
committerJan Tojnar <jtojnar@gmail.com>2022-04-17 11:36:29 +0200
commit753493028426ff4d79389caf404b3aa03f2200da (patch)
tree83b265eb852b92183f370d4e903be692c33d1d60 /pkgs/applications
parent75ad56bdc927f3a9f9e05e3c3614c4c1fcd99fcb (diff)
downloadnixpkgs-753493028426ff4d79389caf404b3aa03f2200da.tar
nixpkgs-753493028426ff4d79389caf404b3aa03f2200da.tar.gz
nixpkgs-753493028426ff4d79389caf404b3aa03f2200da.tar.bz2
nixpkgs-753493028426ff4d79389caf404b3aa03f2200da.tar.lz
nixpkgs-753493028426ff4d79389caf404b3aa03f2200da.tar.xz
nixpkgs-753493028426ff4d79389caf404b3aa03f2200da.tar.zst
nixpkgs-753493028426ff4d79389caf404b3aa03f2200da.zip
osdlyrics: init at 0.5.10
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/audio/osdlyrics/default.nix87
1 files changed, 87 insertions, 0 deletions
diff --git a/pkgs/applications/audio/osdlyrics/default.nix b/pkgs/applications/audio/osdlyrics/default.nix
new file mode 100644
index 00000000000..0c14b8be2b6
--- /dev/null
+++ b/pkgs/applications/audio/osdlyrics/default.nix
@@ -0,0 +1,87 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+
+, autoreconfHook
+, pkg-config
+, intltool
+
+, glib
+, gtk2
+, dbus-glib
+, libappindicator-gtk2
+, libnotify
+, python3
+, runtimeShell
+}:
+
+stdenv.mkDerivation rec {
+  pname = "osdlyrics";
+  version = "0.5.10";
+
+  src = fetchFromGitHub {
+    owner = "osdlyrics";
+    repo = "osdlyrics";
+    rev = version;
+    sha256 = "sha256-x9gIT1JkfPIc4RmmQJLv9rOG2WqAftoTK5uiRlS65zU=";
+  };
+
+  nativeBuildInputs = [
+    autoreconfHook
+    pkg-config
+    intltool
+  ];
+
+  buildInputs = [
+    glib
+    gtk2
+    dbus-glib
+    libappindicator-gtk2
+    libnotify
+    python3.pkgs.wrapPython
+    (python3.withPackages (pp: with pp; [
+      chardet
+      dbus-python
+      future
+      pycurl
+      pygobject3
+    ]))
+  ];
+
+  postFixup = ''
+    extractExecLine() {
+      serviceFile=$1
+      program=$2
+
+      execLine=$(grep --only-matching --perl-regexp 'Exec=\K(.+)' "$serviceFile")
+      echo "#!${runtimeShell}" > "$program"
+      echo "exec $execLine" >> "$program"
+      chmod +x "$program"
+
+      substituteInPlace "$serviceFile" \
+        --replace "Exec=$execLine" "Exec=$program"
+    }
+
+    # Extract the exec line into a separate program so that it can be wrapped.
+    mkdir -p "$out/libexec/osdlyrics/"
+    for svcFile in "$out/share/dbus-1/services"/*; do
+      svc=$(basename "$svcFile" ".service")
+      if grep "python" "$svcFile"; then
+        extractExecLine "$svcFile" "$out/libexec/osdlyrics/$svc"
+      fi
+    done
+
+    for p in "$out/bin/osdlyrics-create-lyricsource" "$out/bin/osdlyrics-daemon" "$out/libexec/osdlyrics"/*; do
+      wrapProgram "$p" \
+        --prefix PYTHONPATH : "$out/${python3.sitePackages}"
+    done
+  '';
+
+  meta = with lib; {
+    description = "Standalone lyrics fetcher/displayer";
+    homepage = "https://github.com/osdlyrics/osdlyrics";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.linux;
+  };
+}