base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / nc / ncspot / package.nix
blob9a3383f287759a6b8f6ea5e6d0c576730b80d757
2   lib,
3   stdenv,
4   alsa-lib,
5   apple-sdk_11,
6   config,
7   dbus,
8   fetchFromGitHub,
9   libpulseaudio,
10   libxcb,
11   ncspot,
12   ncurses,
13   nix-update-script,
14   openssl,
15   pkg-config,
16   portaudio,
17   python3,
18   rustPlatform,
19   testers,
20   ueberzug,
21   withALSA ? stdenv.hostPlatform.isLinux,
22   withClipboard ? true,
23   withCover ? false,
24   withCrossterm ? true,
25   withMPRIS ? stdenv.hostPlatform.isLinux,
26   withNcurses ? false,
27   withNotify ? true,
28   withPancurses ? false,
29   withPortAudio ? stdenv.hostPlatform.isDarwin,
30   withPulseAudio ? config.pulseaudio or stdenv.hostPlatform.isLinux,
31   withRodio ? false,
32   withShareSelection ? false,
33   withTermion ? false,
36 rustPlatform.buildRustPackage rec {
37   pname = "ncspot";
38   version = "1.2.1";
40   src = fetchFromGitHub {
41     owner = "hrkfdn";
42     repo = "ncspot";
43     rev = "refs/tags/v${version}";
44     hash = "sha256-h3Mp67AKuzzeO6l7jN6yrQAHpYSsaOp1Y+qJoamK82U=";
45   };
47   cargoHash = "sha256-uWnW4Ov5MoDh3xkmTsNSin9WI0SJAoDGa+n8IMNvo4Y=";
49   nativeBuildInputs = [ pkg-config ] ++ lib.optional withClipboard python3;
51   buildInputs =
52     [ ncurses ]
53     ++ lib.optional stdenv.hostPlatform.isDarwin apple-sdk_11
54     ++ lib.optional stdenv.hostPlatform.isLinux openssl
55     ++ lib.optional (withALSA || withRodio) alsa-lib
56     ++ lib.optional withClipboard libxcb
57     ++ lib.optional withCover ueberzug
58     ++ lib.optional (withMPRIS || withNotify) dbus
59     ++ lib.optional withNcurses ncurses
60     ++ lib.optional withPortAudio portaudio
61     ++ lib.optional withPulseAudio libpulseaudio;
63   env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-DNCURSES_UNCTRL_H_incl";
65   buildNoDefaultFeatures = true;
67   buildFeatures =
68     lib.optional withALSA "alsa_backend"
69     ++ lib.optional withClipboard "share_clipboard"
70     ++ lib.optional withCover "cover"
71     ++ lib.optional withCrossterm "crossterm_backend"
72     ++ lib.optional withMPRIS "mpris"
73     ++ lib.optional withNcurses "ncurses_backend"
74     ++ lib.optional withNotify "notify"
75     ++ lib.optional withPancurses "pancurses_backend"
76     ++ lib.optional withPortAudio "portaudio_backend"
77     ++ lib.optional withPulseAudio "pulseaudio_backend"
78     ++ lib.optional withRodio "rodio_backend"
79     ++ lib.optional withShareSelection "share_selection"
80     ++ lib.optional withTermion "termion_backend";
82   postInstall = ''
83     install -D --mode=444 $src/misc/ncspot.desktop $out/share/applications/ncspot.desktop
84     install -D --mode=444 $src/images/logo.svg $out/share/icons/hicolor/scalable/apps/ncspot.svg
85   '';
87   passthru = {
88     tests.version = testers.testVersion { package = ncspot; };
89     updateScript = nix-update-script { };
90   };
92   meta = {
93     description = "Cross-platform ncurses Spotify client written in Rust, inspired by ncmpc and the likes";
94     homepage = "https://github.com/hrkfdn/ncspot";
95     changelog = "https://github.com/hrkfdn/ncspot/releases/tag/v${version}";
96     license = lib.licenses.bsd2;
97     maintainers = with lib.maintainers; [
98       liff
99       getchoo
100     ];
101     mainProgram = "ncspot";
102   };