Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 90 lines 2.7 kB view raw
1{ 2 lib, 3 stdenv, 4 config, 5 alsa-lib, 6 apple-sdk_11, 7 cmake, 8 dbus, 9 fetchFromGitHub, 10 libjack2, 11 libpulseaudio, 12 nix-update-script, 13 openssl, 14 pkg-config, 15 portaudio, 16 rustPlatform, 17 testers, 18 withALSA ? stdenv.hostPlatform.isLinux, 19 withJack ? stdenv.hostPlatform.isLinux, 20 withMpris ? stdenv.hostPlatform.isLinux, 21 withPortAudio ? stdenv.hostPlatform.isDarwin, 22 withPulseAudio ? config.pulseaudio or stdenv.hostPlatform.isLinux, 23}: 24 25rustPlatform.buildRustPackage (finalAttrs: { 26 pname = "spotifyd"; 27 version = "0.4.1"; 28 29 src = fetchFromGitHub { 30 owner = "Spotifyd"; 31 repo = "spotifyd"; 32 tag = "v${finalAttrs.version}"; 33 hash = "sha256-IqJlqcau0AZAqQjlaEKzinqTdVUA48/m2Y3ioFP/4Zw="; 34 }; 35 36 cargoHash = "sha256-wZ/JJZDo+Iz5vg4XawcZFvjOEqpD5I0jTfg1JyH3+MA="; 37 38 nativeBuildInputs = [ 39 cmake 40 pkg-config 41 rustPlatform.bindgenHook 42 ]; 43 44 buildInputs = 45 lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_11 ] 46 ++ lib.optionals stdenv.hostPlatform.isLinux [ openssl ] 47 # The `dbus_mpris` feature works on other platforms, but only requires `dbus` on Linux 48 ++ lib.optional (withMpris && stdenv.hostPlatform.isLinux) dbus 49 ++ lib.optional (withALSA || withJack) alsa-lib 50 ++ lib.optional withJack libjack2 51 ++ lib.optional withPulseAudio libpulseaudio 52 ++ lib.optional withPortAudio portaudio; 53 54 # `aws-lc-sys` fails with this enabled 55 hardeningDisable = [ "strictoverflow" ]; 56 57 buildNoDefaultFeatures = true; 58 buildFeatures = 59 lib.optional withALSA "alsa_backend" 60 ++ lib.optional withJack "rodiojack_backend" 61 ++ lib.optional withMpris "dbus_mpris" 62 ++ lib.optional withPortAudio "portaudio_backend" 63 ++ lib.optional withPulseAudio "pulseaudio_backend"; 64 65 checkFlags = lib.optionals stdenv.hostPlatform.isDarwin [ 66 # `assertion failed: shell.is_some()` 67 # Internally it's trying to query the user's shell through `dscl`. This is bad 68 # https://github.com/Spotifyd/spotifyd/blob/8777c67988508d3623d3f6b81c9379fb071ac7dd/src/utils.rs#L45-L47 69 "--skip=utils::tests::test_ffi_discovery" 70 ]; 71 72 passthru = { 73 tests.version = testers.testVersion { package = finalAttrs.finalPackage; }; 74 updateScript = nix-update-script { }; 75 }; 76 77 meta = { 78 description = "Open source Spotify client running as a UNIX daemon"; 79 homepage = "https://spotifyd.rs/"; 80 changelog = "https://github.com/Spotifyd/spotifyd/releases/tag/${toString finalAttrs.src.tag}"; 81 license = lib.licenses.gpl3Plus; 82 maintainers = with lib.maintainers; [ 83 anderslundstedt 84 Br1ght0ne 85 getchoo 86 ]; 87 platforms = lib.platforms.unix; 88 mainProgram = "spotifyd"; 89 }; 90})