Skip to content

Commit 0d755f7

Browse files
spicetify-cli: rework (#397551)
2 parents 2bb95af + 6bf88ff commit 0d755f7

File tree

2 files changed

+51
-21
lines changed

2 files changed

+51
-21
lines changed

pkgs/by-name/sp/spicetify-cli/package.nix

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@
33
buildGoModule,
44
fetchFromGitHub,
55
testers,
6+
replaceVars,
67
spicetify-cli,
78
}:
8-
9-
buildGoModule rec {
10-
pname = "spicetify-cli";
9+
let
1110
version = "2.39.6";
11+
in
12+
buildGoModule {
13+
pname = "spicetify-cli";
14+
inherit version;
1215

1316
src = fetchFromGitHub {
1417
owner = "spicetify";
1518
repo = "cli";
16-
rev = "v${version}";
19+
tag = "v${version}";
1720
hash = "sha256-rdyHVHKVgl9fOviFYQuXY8Ko+/XwpKlKDfriQAgkusE=";
1821
};
1922

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

27-
# used at runtime, but not installed by default
28-
postInstall = ''
29-
mv $out/bin/cli $out/bin/spicetify
30-
ln -s $out/bin/spicetify $out/bin/spicetify-cli
31-
cp -r ${src}/jsHelper $out/bin/jsHelper
32-
cp -r ${src}/CustomApps $out/bin/CustomApps
33-
cp -r ${src}/Extensions $out/bin/Extensions
34-
cp -r ${src}/Themes $out/bin/Themes
35-
'';
36-
37-
doInstallCheck = true;
38-
installCheckPhase = ''
39-
$out/bin/spicetify --help > /dev/null
40-
'';
30+
patches = [
31+
# Stops spicetify from attempting to fetch a newer css-map.json
32+
(replaceVars ./version.patch {
33+
inherit version;
34+
})
35+
];
36+
37+
postInstall =
38+
/*
39+
jsHelper and css-map.json are required at runtime
40+
and are looked for in the directory of the spicetify binary
41+
so here we move spicetify to /share/spicetify
42+
so that css-map.json and jsHelper don't pollute PATH
43+
*/
44+
''
45+
mkdir -p $out/share/spicetify
46+
47+
cp -r $src/jsHelper $out/share/spicetify/jsHelper
48+
cp $src/css-map.json $out/share/spicetify/css-map.json
49+
50+
mv $out/bin/cli $out/share/spicetify/spicetify
51+
52+
ln -s $out/share/spicetify/spicetify $out/bin/spicetify
53+
'';
4154

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

44-
meta = with lib; {
57+
meta = {
4558
description = "Command-line tool to customize Spotify client";
4659
homepage = "https://github.com/spicetify/cli";
47-
license = licenses.gpl3Plus;
48-
maintainers = [ maintainers.mdarocha ];
60+
license = lib.licenses.gpl3Plus;
61+
maintainers = with lib.maintainers; [
62+
mdarocha
63+
gerg-l
64+
];
4965
mainProgram = "spicetify";
5066
};
5167
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
diff --git a/src/preprocess/preprocess.go b/src/preprocess/preprocess.go
2+
index ac0f084..f38ece2 100644
3+
--- a/src/preprocess/preprocess.go
4+
+++ b/src/preprocess/preprocess.go
5+
@@ -66,7 +66,7 @@ func Start(version string, extractedAppsPath string, flags Flag) {
6+
var cssTranslationMap = make(map[string]string)
7+
// readSourceMapAndGenerateCSSMap(appPath)
8+
9+
- if version != "Dev" {
10+
+ if version != "@version@" {
11+
tag, err := FetchLatestTagMatchingOrMain(version)
12+
if err != nil {
13+
utils.PrintWarning("Cannot fetch version tag for CSS mappings")
14+

0 commit comments

Comments
 (0)