nixpkgs/pkgs/by-name/yt/ytui-music/package.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

69 lines
1.3 KiB
Nix

{ lib
, rustPlatform
, fetchFromGitHub
, pkg-config
, openssl
, sqlite
, stdenv
, darwin
, mpv
, youtube-dl
, makeBinaryWrapper
}:
rustPlatform.buildRustPackage rec {
pname = "ytui-music";
version = "2.0.0-rc1";
src = fetchFromGitHub {
owner = "sudipghimire533";
repo = "ytui-music";
rev = "v${version}";
hash = "sha256-f/23PVk4bpUCvcQ25iNI/UVXqiPBzPKWq6OohVF41p8=";
};
cargoHash = "sha256-766Wev2/R/9LLlWWxOPl6y4CBRUU4hUrTDlVVuoJ8C8=";
checkFlags = [
"--skip=tests::display_config_path"
"--skip=tests::inspect_server_list"
];
nativeBuildInputs = [
pkg-config
makeBinaryWrapper
];
buildInputs = [
openssl
sqlite
mpv
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.CoreFoundation
darwin.apple_sdk.frameworks.Security
];
postInstall = ''
wrapProgram $out/bin/ytui_music \
--prefix PATH : ${lib.makeBinPath [ youtube-dl ]}
'';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/ytui_music help
runHook postInstallCheck
'';
meta = with lib; {
description = "Youtube client in terminal for music";
homepage = "https://github.com/sudipghimire533/ytui-music";
license = licenses.gpl2Only;
maintainers = with maintainers; [ kashw2 ];
mainProgram = "ytui_music";
};
}