nur-packages/pkgs/applications/audio/psst/default.nix

73 lines
1.7 KiB
Nix
Raw Normal View History

2021-01-04 12:02:21 +11:00
{ stdenv
, lib
2021-01-04 12:02:21 +11:00
, fetchFromGitHub
, rustPlatform
, cmake
, pkg-config
, openssl
# GUI
, withGui ? true
, copyDesktopItems
, makeDesktopItem
, gtk3
}:
let
inherit (lib) optional optionals;
2021-01-04 12:02:21 +11:00
in
assert withGui -> gtk3.meta.available;
rustPlatform.buildRustPackage rec {
pname = "psst";
version = "20210122.gec114ac";
2021-01-04 12:02:21 +11:00
src = fetchFromGitHub {
owner = "jpochyla";
repo = "psst";
rev = "ec114ac8299179c8dd51bc026d6060dc75658b83";
sha256 = "02mh6hjnlimadc3w899hccss31p1r4sxgb5880zwn7yiycbq3yyj";
2021-01-04 12:02:21 +11:00
fetchSubmodules = true;
};
cargoSha256 = "1m01rycnpy9asspih1x9l5ppfbjnqcfdycmzgkrmdwzah3x8s8xc";
2021-01-04 12:02:21 +11:00
nativeBuildInputs = [ pkg-config ]
++ optional withGui copyDesktopItems;
buildInputs = [ openssl ]
++ optional withGui gtk3;
cargoBuildFlags = optionals (!withGui) [
"--workspace"
"--exclude"
"psst-gui"
];
# Unable to exclude targets from the check phase as it doesn't respect
# `cargoBuildFlags`; to save from attempting to build the GUI without meaning
# to, don't bother checking for CLI-only builds.
# https://github.com/NixOS/nixpkgs/blob/77d190f10931c1d06d87bf6d772bf65346c71777/pkgs/build-support/rust/default.nix#L241
doCheck = withGui;
desktopItems = optionals withGui [
(makeDesktopItem {
name = pname;
desktopName = "psst";
genericName = "Spotify Player";
categories = [ "AudioVideo" "Audio" "Network" "Player" ];
2021-01-04 12:02:21 +11:00
comment = "Spotify client with native GUI";
exec = "psst-gui";
keywords = [ "spotify" "music" ];
2021-01-04 12:02:21 +11:00
icon = "spotify";
type = "Application";
})
];
meta = with lib; {
2021-01-04 12:02:21 +11:00
description = "Fast and multi-platform Spotify client with native GUI ";
homepage = "https://github.com/jpochyla/psst";
license = licenses.mit;
};
}