nixpkgs/pkgs/applications/audio/termusic/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

97 lines
2.3 KiB
Nix

{
alsa-lib
, AppKit
, CoreAudio
, CoreGraphics
, dbus
, Foundation
, fetchFromGitHub
, fetchpatch
, glib
, gst_all_1
, IOKit
, lib
, MediaPlayer
, mpv-unwrapped
, openssl
, pkg-config
, protobuf
, rustPlatform
, Security
, sqlite
, stdenv
}:
rustPlatform.buildRustPackage rec {
pname = "termusic";
version = "0.9.1";
src = fetchFromGitHub {
owner = "tramhao";
repo = "termusic";
rev = "v${version}";
hash = "sha256-aEkg1j6R86QGn21HBimtZwmjmW1K9Wo+67G4DlpY960=";
};
cargoPatches = [
# both following patches can be removed with the follow up release to 0.9.1 as they are cherry-picked from `termusic/master` branch
# fix build issue with 0.9.1 release and vendoring producing wrong hash for soundtouch-ffi
(fetchpatch {
url = "https://github.com/tramhao/termusic/commit/211fc3fe008932d052d31d3b836e8a80eade3cfe.patch";
hash = "sha256-11kSI28YonoTe5W31+R76lGhNiN1ZLAg94FrfYiZUAY=";
})
# fix a bug through previous patch
(fetchpatch {
url = "https://github.com/tramhao/termusic/commit/2a40b2f366dfa5c1f008c79a3ff5c1bbf53fe10f.patch";
hash = "sha256-b7CJ5SqxrU1Jr4GDaJe9sFutDHMqIQxGhXbBFGB6y84=";
})
];
postPatch = ''
pushd $cargoDepsCopy/stream-download
oldHash=$(sha256sum src/lib.rs | cut -d " " -f 1)
substituteInPlace $cargoDepsCopy/stream-download/src/lib.rs \
--replace-warn '#![doc = include_str!("../README.md")]' ""
substituteInPlace .cargo-checksum.json \
--replace-warn $oldHash $(sha256sum src/lib.rs | cut -d " " -f 1)
popd
'';
cargoHash = "sha256-4PprZdTIcYa8y7FwQVrG0ZBg7N/Xe6HDt/z6ZmaHd5Y=";
useNextest = true;
nativeBuildInputs = [
pkg-config
protobuf
rustPlatform.bindgenHook
];
buildInputs = [
dbus
glib
gst_all_1.gstreamer
mpv-unwrapped
openssl
sqlite
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
AppKit
CoreAudio
CoreGraphics
Foundation
IOKit
MediaPlayer
Security
] ++ lib.optionals stdenv.hostPlatform.isLinux [
alsa-lib
];
meta = {
description = "Terminal Music Player TUI written in Rust";
homepage = "https://github.com/tramhao/termusic";
license = with lib.licenses; [ gpl3Only ];
maintainers = with lib.maintainers; [ devhell ];
mainProgram = "termusic";
};
}