From b98d314b4a449a40677de813f353d60b5c4ab170 Mon Sep 17 00:00:00 2001 From: Ian McFarlane Date: Tue, 21 Mar 2023 08:37:24 -0400 Subject: [PATCH] spotifywm: make behave as patch instead of separate package --- pkgs/applications/audio/spotifywm/default.nix | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/audio/spotifywm/default.nix b/pkgs/applications/audio/spotifywm/default.nix index 0d03e74b623a..7a37efe80aca 100644 --- a/pkgs/applications/audio/spotifywm/default.nix +++ b/pkgs/applications/audio/spotifywm/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, spotify, xorg, runtimeShell }: +{ lib, stdenv, fetchFromGitHub, spotify, xorg, makeWrapper }: stdenv.mkDerivation { pname = "spotifywm-unstable"; version = "2022-10-26"; @@ -10,15 +10,25 @@ stdenv.mkDerivation { sha256 = "sha256-AsXqcoqUXUFxTG+G+31lm45gjP6qGohEnUSUtKypew0="; }; + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ xorg.libX11 ]; propagatedBuildInputs = [ spotify ]; installPhase = '' - echo "#!${runtimeShell}" > spotifywm - echo "LD_PRELOAD="$out/lib/spotifywm.so" ${spotify}/bin/spotify \$*" >> spotifywm - install -Dm644 spotifywm.so $out/lib/spotifywm.so - install -Dm755 spotifywm $out/bin/spotifywm + runHook preInstall + + mkdir -p $out/{bin,lib} + install -Dm644 spotifywm.so $out/lib/ + ln -sf ${spotify}/bin/spotify $out/bin/spotify + + # wrap spotify to use spotifywm.so + wrapProgram $out/bin/spotify --set LD_PRELOAD "$out/lib/spotifywm.so" + # backwards compatibility for people who are using the "spotifywm" binary + ln -sf $out/bin/spotify $out/bin/spotifywm + + runHook postInstall ''; meta = with lib; {