pietdevries94 / spicetify-nix

DEPRICATED: A nix package for using spicetify
MIT License
11 stars 38 forks source link

Consider using flakes #6

Open Ashe opened 2 years ago

Ashe commented 2 years ago

Hey, massive fan of what you're doing, but since I've moved my config over to using flakes I can't seem to make use of your work since it doesn't allow me to pass nixpkgs into the package and therefore the package is impure :(

Would love to see some updates and even getting this into homemanager eventually!

PAI5REECHO commented 2 years ago

I've been trying to write a pure Nix Flake for this but have not succeeded. This is what I have thus far:

{
  outputs = { self, nixpkgs, flake-utils, ... } @ inputs:
    (flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
      let
        pkgs = import inputs.nixpkgs {
          inherit system;
          overlays = [
            (self: super: {
              spotify-unwrapped = super.spotify-unwrapped.overrideAttrs (drv: {
                buildInputs = (drv.buildInputs or [ ]) ++ (with super; [
                  spicetify-cli
                ]);
                postInstall = (drv.postInstall or "") + ''
                  export SPICETIFY_CONFIG=$out

                  touch $out/prefs
                  # Generate config file
                  spicetify-cli config || true
                  sed -i "s|.*spotify_path.*|spotify_path = $out/share/spotify|g" $out/config-xpui.ini
                  sed -i "s|.*prefs_path.*|prefs_path = $out/prefs|g" $out/config-xpui.ini

                  spicetify-cli backup enable-devtool apply
                '';
              });
            })
          ];
          config = {
            allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
              "spotify"
              "spotify-unwrapped"
            ];
          };
        };
        lib = pkgs.lib;
      in
      {
        packages.default = pkgs.spotify;
        defaultPackage = self.packages.${system}.default;
      }
    ));
}
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
Parallel unsquashfs: Using 4 processors
32 inodes (2307 blocks) to write

created 31 files
created 11 directories
created 1 symlink
created 0 devices
created 0 fifos
created 0 sockets
created 0 hardlinks
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
no configure script, doing nothing
@nix { "action": "setPhase", "phase": "buildPhase" }
building
no Makefile, doing nothing
@nix { "action": "setPhase", "phase": "installPhase" }
installing
error Could not detect Spotify location.
error Could not detect "prefs" file location.
success Default config-xpui.ini generated.
error Cannot detect Spotify location. Please manually set "spotify_path" in config-xpui.ini
spicetify vDev
Backing up app files:
OK
Extracting:
OK
Preprocessing:
info In development environment, using local CSS map
warning Cannot read local CSS map.
OK
OK
success Everything is ready, you can start applying now!
success DevTool enabled!
Copying raw assets:
OK
Transferring user.css:
OK
Applying additional modifications:
OK
success Spotify is spiced up!
@nix { "action": "setPhase", "phase": "gappsWrapperArgsHook" }
gappsWrapperArgsHook
@nix { "action": "setPhase", "phase": "fixupPhase" }
post-installation fixup
rewriting symlink /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750/share/icons/hicolor/16x16/apps/spotify-client.png to be relative to /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750
rewriting symlink /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750/share/icons/hicolor/22x22/apps/spotify-client.png to be relative to /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750
rewriting symlink /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750/share/icons/hicolor/24x24/apps/spotify-client.png to be relative to /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750
rewriting symlink /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750/share/icons/hicolor/32x32/apps/spotify-client.png to be relative to /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750
rewriting symlink /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750/share/icons/hicolor/48x48/apps/spotify-client.png to be relative to /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750
rewriting symlink /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750/share/icons/hicolor/64x64/apps/spotify-client.png to be relative to /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750
rewriting symlink /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750/share/icons/hicolor/128x128/apps/spotify-client.png to be relative to /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750
rewriting symlink /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750/share/icons/hicolor/256x256/apps/spotify-client.png to be relative to /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750
rewriting symlink /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750/share/icons/hicolor/512x512/apps/spotify-client.png to be relative to /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750
patching script interpreter paths in /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750
checking for references to /build/ in /nix/store/iw8ppv91ibfh5jiibzcjdyk1199s31d4-spotify-unwrapped-1.1.80.699.gc3dac750...

It says it installs spicetify successfully in the output of the build log but it does not. Running the spotify-customized package with nix run .# shows nothing changed (the dev tools can not be used with Ctrl+Shift+I even though they were enabled).

PAI5REECHO commented 2 years ago

@pietdevries94 do you have any ideas about why this Flake doesn't work, I tried to the minimum needed from https://github.com/pietdevries94/spicetify-nix/blob/c386ede8e3d97daee8e43794a1dd2747b625d3b7/package.nix#L63-L121 but it doesn't work

the-argus commented 2 years ago

@PAI5REECHO @Ashe See #7 if you are still trying to get this working.

Ashe commented 2 years ago

@the-argus thank you, I'll look into it!