From 72006f56b1326bf76e935fb01bd64383b6609d9a Mon Sep 17 00:00:00 2001 From: Sean Kovacs Date: Mon, 15 Dec 2025 21:22:46 -0500 Subject: [PATCH] add spotify webapp --- flake.lock | 39 +++++++++++++++++- flake.nix | 10 +++++ home/default.nix | 3 +- home/hosts/alien/default.nix | 32 ++++++++++++++- home/hosts/peach/default.nix | 1 + packages/overlay.nix | 2 + packages/spotify/package.nix | 74 ++++++++++++++++++++++++++++++++++ system/hosts/alien/default.nix | 2 +- 8 files changed, 159 insertions(+), 4 deletions(-) create mode 100644 packages/spotify/package.nix diff --git a/flake.lock b/flake.lock index 6aa10ce..80a5e73 100644 --- a/flake.lock +++ b/flake.lock @@ -441,7 +441,29 @@ "nixvim": "nixvim", "noctalia": "noctalia", "nur": "nur", - "plasma-manager": "plasma-manager" + "plasma-manager": "plasma-manager", + "spicetify-nix": "spicetify-nix" + } + }, + "spicetify-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_2" + }, + "locked": { + "lastModified": 1765687197, + "narHash": "sha256-5aJgT+lEC7ypuAGE3DQLj3LzYDQ+kRG6MnkVr3ZF9RU=", + "owner": "Gerg-L", + "repo": "spicetify-nix", + "rev": "fa6a5dde9d95bf7b8f075ff5aceeb1d97fa9043a", + "type": "github" + }, + "original": { + "owner": "Gerg-L", + "repo": "spicetify-nix", + "type": "github" } }, "systems": { @@ -459,6 +481,21 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "xwayland-satellite-stable": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index ccec926..4501bb3 100644 --- a/flake.nix +++ b/flake.nix @@ -36,6 +36,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + spicetify-nix = { + url = "github:Gerg-L/spicetify-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nur = { url = "github:nix-community/NUR"; inputs.nixpkgs.follows = "nixpkgs"; @@ -62,6 +67,7 @@ plasma-manager, niri, noctalia, + spicetify-nix, nur, nixvim, apple-silicon, @@ -105,8 +111,12 @@ plasma-manager.homeModules.plasma-manager niri.homeModules.niri noctalia.homeModules.default + spicetify-nix.homeManagerModules.default nixvim.homeModules.nixvim ]; + home-manager.extraSpecialArgs = { + inherit spicetify-nix; + }; } ] ++ extraModules; diff --git a/home/default.nix b/home/default.nix index dc23998..76eaf3b 100755 --- a/home/default.nix +++ b/home/default.nix @@ -125,6 +125,7 @@ spotdl browsh mosh + spotify-player # development & tooling gh @@ -163,7 +164,7 @@ musescore gimp calibre - spotify-player + spotify-qt # overrides # (chromium.override { diff --git a/home/hosts/alien/default.nix b/home/hosts/alien/default.nix index e06487f..6580a5e 100644 --- a/home/hosts/alien/default.nix +++ b/home/hosts/alien/default.nix @@ -1,4 +1,9 @@ -{ config, pkgs, ... }: +{ + config, + pkgs, + spicetify-nix, + ... +}: { catppuccin = { @@ -31,6 +36,31 @@ scale = 1.75; }; + programs.spicetify = + let + spicePkgs = spicetify-nix.legacyPackages.${pkgs.stdenv.hostPlatform.system}; + in + { + enable = true; + + enabledExtensions = with spicePkgs.extensions; [ + adblock + hidePodcasts + shuffle # shuffle+ (special characters are sanitized out of extension names) + ]; + enabledCustomApps = with spicePkgs.apps; [ + newReleases + ncsVisualizer + ]; + enabledSnippets = with spicePkgs.snippets; [ + rotatingCoverart + pointer + ]; + + theme = spicePkgs.themes.catppuccin; + colorScheme = config.catppuccin.flavor; + }; + programs.plasma = { panels = [ # Alternative global menu to fit the modified taskbar diff --git a/home/hosts/peach/default.nix b/home/hosts/peach/default.nix index 0c92f54..1b6a7ab 100644 --- a/home/hosts/peach/default.nix +++ b/home/hosts/peach/default.nix @@ -14,6 +14,7 @@ asahi-wifisync moonlight-qt + spotify-webapp ]; # https://github.com/YaLTeR/niri/issues/2330#issuecomment-3256864777 diff --git a/packages/overlay.nix b/packages/overlay.nix index 7377b92..2764a0b 100644 --- a/packages/overlay.nix +++ b/packages/overlay.nix @@ -24,5 +24,7 @@ final: prev: { inherit helium-widevine; }; + spotify-webapp = prev.callPackage (builtins.path { path = ./spotify/package.nix; }) { }; + spotifyd = prev.callPackage (builtins.path { path = ./spotifyd/package.nix; }) { }; } diff --git a/packages/spotify/package.nix b/packages/spotify/package.nix new file mode 100644 index 0000000..940bc6e --- /dev/null +++ b/packages/spotify/package.nix @@ -0,0 +1,74 @@ +{ + lib, + stdenv, + makeDesktopItem, + copyDesktopItems, + chromium, + writeShellScriptBin, +}: + +let + pname = "spotify-webapp"; + version = "1.0.0"; + + chromiumWithWidevine = chromium.override { + enableWideVine = true; + }; + + launchScript = writeShellScriptBin "spotify-webapp" '' + exec ${chromiumWithWidevine}/bin/chromium \ + --app=https://open.spotify.com \ + --class=spotify-webapp \ + --name=spotify-webapp \ + --user-data-dir="$HOME/.config/spotify-webapp" \ + --enable-features=UseOzonePlatform \ + --ozone-platform=wayland \ + "$@" + ''; + +in +stdenv.mkDerivation { + inherit pname version; + + dontUnpack = true; + dontBuild = true; + + nativeBuildInputs = [ copyDesktopItems ]; + + desktopItems = [ + (makeDesktopItem { + name = "spotify-webapp"; + exec = "spotify-webapp %U"; + icon = "spotify"; + desktopName = "Spotify"; + genericName = "Music Streaming"; + comment = "Listen to music on Spotify"; + categories = [ + "Audio" + "Music" + "AudioVideo" + ]; + mimeTypes = [ "x-scheme-handler/spotify" ]; + startupWMClass = "spotify-webapp"; + startupNotify = true; + }) + ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin + ln -s ${launchScript}/bin/spotify-webapp $out/bin/spotify-webapp + + runHook postInstall + ''; + + meta = with lib; { + description = "Spotify web app running in Chromium"; + homepage = "https://open.spotify.com"; + license = licenses.free; + maintainers = [ ]; + platforms = platforms.linux; + mainProgram = "spotify-webapp"; + }; +} diff --git a/system/hosts/alien/default.nix b/system/hosts/alien/default.nix index 9588212..383f075 100644 --- a/system/hosts/alien/default.nix +++ b/system/hosts/alien/default.nix @@ -46,7 +46,7 @@ "lantian:EeAUQ+W+6r7EtwnmYjeVwx5kOGEBpjlBfPlzGlTNvHc=" "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ]; - boot.kernelPackages = pkgs.cachyosKernels.linuxPackages-cachyos-latest; + boot.kernelPackages = pkgs.cachyosKernels.linuxPackages-cachyos-lts; programs = { gamescope = {