Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using flakes #6

Open
Ashe opened this issue Nov 13, 2021 · 4 comments
Open

Consider using flakes #6

Ashe opened this issue Nov 13, 2021 · 4 comments

Comments

@Ashe
Copy link

Ashe commented Nov 13, 2021

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
Copy link

PAI5REECHO commented Apr 5, 2022

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
Copy link

@pietdevries94 do you have any ideas about why this Flake doesn't work, I tried to the minimum needed from

spicetify-nix/package.nix

Lines 63 to 121 in c386ede

postInstall=''
touch $out/prefs
mkdir Themes
mkdir Extensions
mkdir CustomApps
find ${themes} -maxdepth 1 -type d -exec ln -s {} Themes \;
${extraCommands}
${spicetify} config \
spotify_path "$out/share/spotify" \
prefs_path "$out/prefs" \
current_theme ${theme} \
${if
colorScheme != ""
then
''color_scheme "${colorScheme}" \''
else
''\'' }
${if
extensionString != ""
then
''extensions "${extensionString}" \''
else
''\'' }
${if
customAppsString != ""
then
''custom_apps "${customAppsString}" \''
else
''\'' }
${if
spotifyLaunchFlags != ""
then
''spotify_launch_flags "${spotifyLaunchFlags}" \''
else
''\'' }
inject_css ${injectCssOrDribblish} \
replace_colors ${replaceColorsOrDribblish} \
overwrite_assets ${overwriteAssetsOrDribblish} \
disable_sentry ${boolToString disableSentry } \
disable_ui_logging ${boolToString disableUiLogging } \
remove_rtl_rule ${boolToString removeRtlRule } \
expose_apis ${boolToString exposeApis } \
disable_upgrade_check ${boolToString disableUpgradeCheck } \
fastUser_switching ${boolToString fastUserSwitching } \
visualization_high_framerate ${boolToString visualizationHighFramerate } \
radio ${boolToString radio } \
song_page ${boolToString songPage } \
experimental_features ${boolToString experimentalFeatures } \
home ${boolToString home } \
lyric_always_show ${boolToString lyricAlwaysShow } \
lyric_force_no_sync ${boolToString lyricForceNoSync }
${spicetify} backup apply
cd $out/share/spotify
${customAppsFixupCommands}
'';
but it doesn't work

@the-argus
Copy link

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

@Ashe
Copy link
Author

Ashe commented Aug 9, 2022

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

pietdevries94 pushed a commit that referenced this issue Jul 28, 2024
* flake: rename outputs to match schema/standard

* flake: reintroduce old output names as deprecated

* flake: remove unnecessary uses of rec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants