feat: use spotifywm refactor

This commit is contained in:
matt1432 2023-10-18 15:06:04 -04:00
parent 3a18c8a920
commit b6e79db784
4 changed files with 68 additions and 23 deletions

View file

@ -5,7 +5,10 @@
(import ./swayosd.nix)
(import ./blueberry.nix)
(import ./dracula-theme.nix)
(import ./spotifywm.nix)
(final: prev: {
spotifywm = final.callPackage ./pkgs/spotifywm.nix {};
})
(final: prev: {
input-emulator = final.callPackage ./pkgs/input-emulator.nix {};

View file

@ -0,0 +1,64 @@
# https://github.com/NixOS/nixpkgs/blob/77b27fdb6a9ba01f60b8f5c48038938cf14b7d2f/pkgs/applications/audio/spotifywm/default.nix
{
lib,
stdenv,
fetchFromGitHub,
libX11,
makeBinaryWrapper,
spotify,
symlinkJoin,
}:
let
spotifywm = stdenv.mkDerivation {
pname = "spotifywm-unstable";
version = "2022-10-25";
src = fetchFromGitHub {
owner = "dasJ";
repo = "spotifywm";
rev = "8624f539549973c124ed18753881045968881745";
hash = "sha256-AsXqcoqUXUFxTG+G+31lm45gjP6qGohEnUSUtKypew0=";
};
buildInputs = [
libX11
];
installPhase = ''
runHook preInstall
install -Dm644 spotifywm.so $out/lib/spotifywm.so
runHook postInstall
'';
};
in
symlinkJoin {
inherit (spotifywm) name;
nativeBuildInputs = [
makeBinaryWrapper
];
paths = [
spotify
spotifywm
];
postBuild = ''
wrapProgram $out/bin/spotify \
--suffix LD_PRELOAD : "$out/lib/spotifywm.so"
ln -sf $out/bin/spotify $out/bin/spotifywm
'';
meta = {
homepage = "https://github.com/dasJ/spotifywm";
description = "Wrapper around Spotify that correctly sets class name before opening the window";
license = lib.licenses.mit;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ jqueiroz the-argus ];
mainProgram = "spotify";
};
}

View file

@ -1,21 +0,0 @@
final: prev: {
spotifywm = prev.spotifywm.overrideAttrs (oldAttrs: rec {
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,lib,share}
install -Dm644 spotifywm.so $out/lib/
ln -sf ${prev.spotify}/bin/spotify $out/bin/spotify
ln -sf ${prev.spotify}/share/applications/ $out/share/applications
ln -sf ${prev.spotify}/share/icons $out/share/icons
# 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
'';
});
}

View file

@ -50,7 +50,6 @@ in {
# Misc Apps
thunderbird # TODO: use programs.thunderbird
firefox # TODO: use programs.firefox
spotifywm
zeal
libreoffice-fresh # TODO: add spelling stuff and declarative conf?