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