nixpkgs/pkgs/applications/audio/tauon/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

153 lines
3.5 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
kissfft,
miniaudio,
pkg-config,
python3Packages,
gobject-introspection,
flac,
game-music-emu,
gtk3,
libappindicator,
libnotify,
libopenmpt,
librsvg,
libsamplerate,
libvorbis,
mpg123,
opusfile,
pango,
pipewire,
wavpack,
ffmpeg,
pulseaudio,
withDiscordRPC ? true,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "tauon";
version = "7.8.3";
src = fetchFromGitHub {
owner = "Taiko2k";
repo = "Tauon";
rev = "v${finalAttrs.version}";
hash = "sha256-A7JRJ0Eh0ynuwPYZFLEeqWLf6OKdN59jM2vozdpSZC8=";
};
postUnpack = ''
rmdir source/src/phazor/kissfft
ln -s ${kissfft.src} source/src/phazor/kissfft
rmdir source/src/phazor/miniaudio
ln -s ${miniaudio.src} source/src/phazor/miniaudio
'';
postPatch = ''
substituteInPlace tauon.py \
--replace-fail 'install_mode = False' 'install_mode = True' \
--replace-fail 'install_directory = os.path.dirname(os.path.abspath(__file__))' 'install_directory = "${placeholder "out"}/share/tauon"'
substituteInPlace t_modules/t_main.py \
--replace-fail 'install_mode = False' 'install_mode = True' \
--replace-fail 'libopenmpt.so' '${lib.getLib libopenmpt}/lib/libopenmpt.so'
substituteInPlace t_modules/t_phazor.py \
--replace-fail 'lib/libphazor' '../../lib/libphazor'
substituteInPlace compile-phazor*.sh --replace-fail 'gcc' '${stdenv.cc.targetPrefix}cc'
substituteInPlace extra/tauonmb.desktop --replace-fail 'Exec=/opt/tauon-music-box/tauonmb.sh' 'Exec=${placeholder "out"}/bin/tauon'
'';
postBuild = ''
bash ./compile-phazor.sh
bash ./compile-phazor-pipewire.sh
'';
nativeBuildInputs = [
pkg-config
python3Packages.wrapPython
gobject-introspection
];
buildInputs = [
flac
game-music-emu
gtk3
libappindicator
libnotify
libopenmpt
librsvg
libsamplerate
libvorbis
mpg123
opusfile
pango
pipewire
wavpack
];
pythonPath =
with python3Packages;
[
beautifulsoup4
dbus-python
unidecode
jxlpy
musicbrainzngs
mutagen
natsort
pillow
plexapi
pycairo
pychromecast
pylast
pygobject3
pysdl2
requests
send2trash
setproctitle
]
++ lib.optional withDiscordRPC pypresence
++ lib.optional stdenv.hostPlatform.isLinux pulsectl;
makeWrapperArgs = [
"--prefix PATH : ${lib.makeBinPath [ ffmpeg ]}"
"--prefix LD_LIBRARY_PATH : ${
lib.makeLibraryPath [
game-music-emu
pulseaudio
]
}"
"--prefix PYTHONPATH : $out/share/tauon"
"--set GI_TYPELIB_PATH $GI_TYPELIB_PATH"
];
installPhase = ''
install -Dm755 tauon.py $out/bin/tauon
mkdir -p $out/share/tauon
cp -r lib $out
cp -r assets input.txt t_modules theme templates $out/share/tauon
wrapPythonPrograms
mkdir -p $out/share/applications
install -Dm755 extra/tauonmb.desktop $out/share/applications/tauonmb.desktop
mkdir -p $out/share/icons/hicolor/scalable/apps
install -Dm644 extra/tauonmb{,-symbolic}.svg $out/share/icons/hicolor/scalable/apps
'';
meta = with lib; {
description = "Linux desktop music player from the future";
mainProgram = "tauon";
homepage = "https://tauonmusicbox.rocks/";
changelog = "https://github.com/Taiko2k/TauonMusicBox/releases/tag/v${finalAttrs.version}";
license = licenses.gpl3;
maintainers = with maintainers; [ jansol ];
platforms = platforms.linux ++ platforms.darwin;
};
})