1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 testers,
6 replaceVars,
7 spicetify-cli,
8}:
9buildGoModule (finalAttrs: {
10 pname = "spicetify-cli";
11 version = "2.40.11";
12
13 src = fetchFromGitHub {
14 owner = "spicetify";
15 repo = "cli";
16 tag = "v${finalAttrs.version}";
17 hash = "sha256-CVCp9XzbVM0XAtgtBfMLLQTymzMTZfpoL9RrLI9MaDY=";
18 };
19
20 vendorHash = "sha256-iD6sKhMnvc0RczoSCWCx/72/zjoC6YQyV+AYyE4w/b0=";
21
22 ldflags = [
23 "-s -w"
24 "-X 'main.version=${finalAttrs.version}'"
25 ];
26
27 patches = [
28 # Stops spicetify from attempting to fetch a newer css-map.json
29 (replaceVars ./version.patch {
30 inherit (finalAttrs) version;
31 })
32 ];
33
34 postInstall =
35 /*
36 jsHelper and css-map.json are required at runtime
37 and are looked for in the directory of the spicetify binary
38 so here we move spicetify to /share/spicetify
39 so that css-map.json and jsHelper don't pollute PATH
40 */
41 ''
42 mkdir -p $out/share/spicetify
43
44 cp -r $src/jsHelper $out/share/spicetify/jsHelper
45 cp $src/css-map.json $out/share/spicetify/css-map.json
46
47 mv $out/bin/cli $out/share/spicetify/spicetify
48
49 ln -s $out/share/spicetify/spicetify $out/bin/spicetify
50 '';
51
52 passthru.tests.version = testers.testVersion { package = spicetify-cli; };
53
54 meta = {
55 description = "Command-line tool to customize Spotify client";
56 homepage = "https://github.com/spicetify/cli";
57 license = lib.licenses.gpl3Plus;
58 maintainers = with lib.maintainers; [
59 mdarocha
60 gerg-l
61 ];
62 mainProgram = "spicetify";
63 };
64})