diff --git a/common/overlays/default.nix b/common/overlays/default.nix index d49b1ef2..08a83a38 100644 --- a/common/overlays/default.nix +++ b/common/overlays/default.nix @@ -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 {}; diff --git a/common/overlays/pkgs/spotifywm.nix b/common/overlays/pkgs/spotifywm.nix new file mode 100644 index 00000000..24aa50a1 --- /dev/null +++ b/common/overlays/pkgs/spotifywm.nix @@ -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"; + }; +} diff --git a/common/overlays/spotifywm.nix b/common/overlays/spotifywm.nix deleted file mode 100644 index 4478b7a7..00000000 --- a/common/overlays/spotifywm.nix +++ /dev/null @@ -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 - ''; - }); -} - diff --git a/hosts/wim/home/packages.nix b/hosts/wim/home/packages.nix index 113bb783..e815bb5d 100644 --- a/hosts/wim/home/packages.nix +++ b/hosts/wim/home/packages.nix @@ -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?