Skip to content

Commit

Permalink
Revert "gnomeExtensions.volume-mixer: remove"
Browse files Browse the repository at this point in the history
This reverts commit ee5506c.

Further:
* Add it to the gnomeExtensions attrset. (The reason for removing it in
  the first place was because it wasn't registered there.)
* Move from .../volume-mixer.nix to .../volume-mixer/default.nix, to
  align with the other extensions.
* Update to latest version.
* Fix the installPhase.
* Comment that there is a Makefile for this package, but it requires
  npm, so keep the buildPhase unchanged.
* Add missing deps: pulseaudio and python3
* Add a small patch to find pulseaudio.
* Replace maintainer aneeshusa with bjornfor, as aneeshusa doesn't seem
  interested in this package anymore.
  • Loading branch information
bjornfor committed Nov 23, 2020
1 parent 213cf1a commit 2fd655b
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
47 changes: 47 additions & 0 deletions pkgs/desktops/gnome-3/extensions/volume-mixer/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{ stdenv, fetchFromGitHub, glib, pulseaudio, python3 }:

stdenv.mkDerivation rec {
pname = "gnome-shell-volume-mixer";
version = "3.36.6";

src = fetchFromGitHub {
owner = "aleho";
repo = "gnome-shell-volume-mixer";
rev = version;
sha256 = "1s80w5csv82hxky33ql734z9df8zkg1r8xmxc9hl759z6rbqml9g";
};

patches = [
./find_libpulse.patch
];

buildInputs = [
glib
pulseaudio
python3
];

postPatch = ''
substituteInPlace ./shell-volume-mixer@derhofbauer.at/pautils/pa.py \
--subst-var-by pulseaudio ${pulseaudio}
'';

# Could use the Makefile, but it requires npm...
buildPhase = ''
glib-compile-schemas --targetdir=${uuid}/schemas ${uuid}/schemas
'';

installPhase = ''
mkdir -p $out/share/gnome-shell/extensions/${uuid}
cp -r ${uuid} $out/share/gnome-shell/extensions/
'';

uuid = "shell-volume-mixer@derhofbauer.at";

meta = with stdenv.lib; {
description = "GNOME Shell Extension allowing separate configuration of PulseAudio devices";
license = licenses.gpl2;
maintainers = with maintainers; [ bjornfor ];
homepage = https://github.com/aleho/gnome-shell-volume-mixer;
};
}
19 changes: 19 additions & 0 deletions pkgs/desktops/gnome-3/extensions/volume-mixer/find_libpulse.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Find libpulse.so via direct reference.

Author: Bjørn Forsman <bjorn.forsman@gmail.com>
diff --git a/shell-volume-mixer@derhofbauer.at/pautils/pa.py b/shell-volume-mixer@derhofbauer.at/pautils/pa.py
index 7d058bd..00edd6a 100644
--- a/shell-volume-mixer@derhofbauer.at/pautils/pa.py
+++ b/shell-volume-mixer@derhofbauer.at/pautils/pa.py
@@ -16,9 +16,9 @@
from ctypes import *

try:
- lib = CDLL('libpulse.so.0')
+ lib = CDLL('@pulseaudio@/lib/libpulse.so.0')
except:
- lib = CDLL('libpulse.so')
+ lib = CDLL('@pulseaudio@/lib/libpulse.so')

STRING = c_char_p
WSTRING = c_wchar_p
1 change: 1 addition & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26127,6 +26127,7 @@ in
tilingnome = callPackage ../desktops/gnome-3/extensions/tilingnome { };
timepp = callPackage ../desktops/gnome-3/extensions/timepp { };
topicons-plus = callPackage ../desktops/gnome-3/extensions/topicons-plus { };
volume-mixer = callPackage ../desktops/gnome-3/extensions/volume-mixer { };
window-corner-preview = callPackage ../desktops/gnome-3/extensions/window-corner-preview { };
window-is-ready-remover = callPackage ../desktops/gnome-3/extensions/window-is-ready-remover { };
workspace-matrix = callPackage ../desktops/gnome-3/extensions/workspace-matrix { };
Expand Down

0 comments on commit 2fd655b

Please sign in to comment.