From d4c1fd085be2b90301db201ed3badd2095ebd62a Mon Sep 17 00:00:00 2001 From: Dmitriy Kholkin Date: Sat, 7 Jun 2025 21:34:48 +0300 Subject: [PATCH] feat: add spotify with spotx patch applied --- modules/home/applications/spotify.nix | 34 +++++++++++++++++++++++++++ modules/home/roles/default.nix | 1 + overlays/default.nix | 31 ++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 modules/home/applications/spotify.nix diff --git a/modules/home/applications/spotify.nix b/modules/home/applications/spotify.nix new file mode 100644 index 0000000..c6330a1 --- /dev/null +++ b/modules/home/applications/spotify.nix @@ -0,0 +1,34 @@ +{ + config, + lib, + pkgs, + ... +}: +let + inherit (lib) getExe mkEnableOption mkIf; + cfg = config.ataraxia.programs.spotify; +in +{ + options.ataraxia.programs.spotify = { + enable = mkEnableOption "Enable spotify program"; + }; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + spotifywm + ]; + + defaultApplications.spotify = { + cmd = getExe pkgs.spotifywm; + desktop = "spotify"; + }; + + startupApplications = [ + config.defaultApplications.spotify.cmd + ]; + + persist.state.directories = [ + ".config/spotify" + ]; + }; +} diff --git a/modules/home/roles/default.nix b/modules/home/roles/default.nix index 86ffe21..ebc245c 100644 --- a/modules/home/roles/default.nix +++ b/modules/home/roles/default.nix @@ -83,6 +83,7 @@ in ataraxia.programs.kitty.enable = mkDefault true; ataraxia.programs.mpv.enable = mkDefault true; ataraxia.programs.rofi.enable = mkDefault true; + ataraxia.programs.spotify.enable = mkDefault true; ataraxia.programs.telegram.enable = mkDefault true; ataraxia.programs.thunderbird.enable = mkDefault true; ataraxia.programs.vscode.enable = mkDefault true; diff --git a/overlays/default.nix b/overlays/default.nix index 4fba70d..ae8fe13 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -34,6 +34,37 @@ in sing-box = unstable.sing-box; wine = prev.wineWow64Packages.stagingFull; + # Patch spotify with spotx + spotify = prev.spotify.overrideAttrs ( + oa: + let + spotx = prev.fetchurl { + url = "https://raw.githubusercontent.com/SpotX-Official/SpotX-Bash/b1de24ec4c23c45da373dcb64a44e372253a0c16/spotx.sh"; + hash = "sha256-/p6cJKzaZzjcLJISFudstQjs+lPXnXx4f0vxKbF9Sqw="; + }; + in + { + nativeBuildInputs = + oa.nativeBuildInputs + ++ (with prev; [ + perl + unzip + util-linux + zip + ]); + postUnpack = + oa.postUnpack or "" + + '' + patchShebangs --build ${spotx} + ''; + postInstall = + oa.postInstall or "" + + '' + bash ${spotx} -f -h -P "$out/share/spotify" + ''; + } + ); + # Move modprobed config to subdir. Easier to use with impermanence modprobed-db = prev.modprobed-db.overrideAttrs (oa: { nativeBuildInputs = [ prev.makeWrapper ] ++ oa.nativeBuildInputs or [ ];