Unverified Commit 0d755f72 authored by Arne Keller's avatar Arne Keller Committed by GitHub
Browse files

spicetify-cli: rework (#397551)

parents 2bb95af3 6bf88ff2
Loading
Loading
Loading
Loading
+37 −21
Original line number Diff line number Diff line
@@ -3,17 +3,20 @@
  buildGoModule,
  fetchFromGitHub,
  testers,
  replaceVars,
  spicetify-cli,
}:

buildGoModule rec {
  pname = "spicetify-cli";
let
  version = "2.39.6";
in
buildGoModule {
  pname = "spicetify-cli";
  inherit version;

  src = fetchFromGitHub {
    owner = "spicetify";
    repo = "cli";
    rev = "v${version}";
    tag = "v${version}";
    hash = "sha256-rdyHVHKVgl9fOviFYQuXY8Ko+/XwpKlKDfriQAgkusE=";
  };

@@ -24,28 +27,41 @@ buildGoModule rec {
    "-X 'main.version=${version}'"
  ];

  # used at runtime, but not installed by default
  postInstall = ''
    mv $out/bin/cli $out/bin/spicetify
    ln -s $out/bin/spicetify $out/bin/spicetify-cli
    cp -r ${src}/jsHelper $out/bin/jsHelper
    cp -r ${src}/CustomApps $out/bin/CustomApps
    cp -r ${src}/Extensions $out/bin/Extensions
    cp -r ${src}/Themes $out/bin/Themes
  '';
  patches = [
    # Stops spicetify from attempting to fetch a newer css-map.json
    (replaceVars ./version.patch {
      inherit version;
    })
  ];

  doInstallCheck = true;
  installCheckPhase = ''
    $out/bin/spicetify --help > /dev/null
  postInstall =
    /*
      jsHelper and css-map.json are required at runtime
      and are looked for in the directory of the spicetify binary
      so here we move spicetify to /share/spicetify
      so that css-map.json and jsHelper don't pollute PATH
    */
    ''
      mkdir -p $out/share/spicetify

      cp -r $src/jsHelper $out/share/spicetify/jsHelper
      cp $src/css-map.json $out/share/spicetify/css-map.json

      mv $out/bin/cli $out/share/spicetify/spicetify

      ln -s $out/share/spicetify/spicetify $out/bin/spicetify
    '';

  passthru.tests.version = testers.testVersion { package = spicetify-cli; };

  meta = with lib; {
  meta = {
    description = "Command-line tool to customize Spotify client";
    homepage = "https://github.com/spicetify/cli";
    license = licenses.gpl3Plus;
    maintainers = [ maintainers.mdarocha ];
    license = lib.licenses.gpl3Plus;
    maintainers = with lib.maintainers; [
      mdarocha
      gerg-l
    ];
    mainProgram = "spicetify";
  };
}
+14 −0
Original line number Diff line number Diff line
diff --git a/src/preprocess/preprocess.go b/src/preprocess/preprocess.go
index ac0f084..f38ece2 100644
--- a/src/preprocess/preprocess.go
+++ b/src/preprocess/preprocess.go
@@ -66,7 +66,7 @@ func Start(version string, extractedAppsPath string, flags Flag) {
 	var cssTranslationMap = make(map[string]string)
 	// readSourceMapAndGenerateCSSMap(appPath)
 
-	if version != "Dev" {
+	if version != "@version@" {
 		tag, err := FetchLatestTagMatchingOrMain(version)
 		if err != nil {
 			utils.PrintWarning("Cannot fetch version tag for CSS mappings")