nixpkgs/pkgs/applications/networking/mkchromecast/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

89 lines
2.2 KiB
Nix
Raw Normal View History

{ lib, stdenv
2019-03-07 13:36:41 +00:00
, fetchFromGitHub
, python3Packages
, sox
, flac
, lame
, wrapQtAppsHook
, ffmpeg
, vorbis-tools
, pulseaudio
, nodejs
, youtube-dl
, opusTools
, gst_all_1
, enableSonos ? true
2023-06-15 21:41:23 +00:00
, qtwayland
2019-03-07 13:36:41 +00:00
}:
let packages = [
vorbis-tools
sox
flac
lame
opusTools
gst_all_1.gstreamer
nodejs
ffmpeg
youtube-dl
2021-01-15 13:21:58 +00:00
] ++ lib.optionals stdenv.isLinux [ pulseaudio ];
2019-03-07 13:36:41 +00:00
in
2023-06-15 21:41:23 +00:00
python3Packages.buildPythonApplication {
2019-03-07 13:36:41 +00:00
pname = "mkchromecast-unstable";
2022-11-26 01:16:27 +00:00
version = "2022-10-31";
2019-03-07 13:36:41 +00:00
2023-06-15 21:41:23 +00:00
src = fetchFromGitHub {
2019-03-07 13:36:41 +00:00
owner = "muammar";
repo = "mkchromecast";
2022-11-26 01:16:27 +00:00
rev = "0de9fd78c4122dec4f184aeae2564790b45fe6dc";
sha256 = "sha256-dxsIcBPrZaXlsfzOEXhYj2qoK5LRducJG2ggMrMMl9Y=";
2019-03-07 13:36:41 +00:00
};
2023-06-15 21:41:23 +00:00
buildInputs = lib.optional stdenv.isLinux qtwayland;
propagatedBuildInputs = with python3Packages; ([
pychromecast
2019-03-07 13:36:41 +00:00
psutil
mutagen
flask
netifaces
requests
pyqt5
] ++ lib.optionals enableSonos [ soco ]);
2019-03-07 13:36:41 +00:00
postPatch = ''
substituteInPlace setup.py \
--replace 'platform.system() == "Darwin"' 'False' \
--replace 'platform.system() == "Linux"' 'True'
'';
nativeBuildInputs = [ wrapQtAppsHook ];
# Relies on an old version (0.7.7) of PyChromecast unavailable in Nixpkgs.
# Is also I/O bound and impure, testing an actual device, so we disable.
doCheck = false;
dontWrapQtApps = true;
makeWrapperArgs = [
"\${qtWrapperArgs[@]}"
2021-01-15 13:21:58 +00:00
"--prefix PATH : ${lib.makeBinPath packages}"
2019-03-07 13:36:41 +00:00
];
postInstall = ''
substituteInPlace $out/lib/${python3Packages.python.libPrefix}/site-packages/mkchromecast/video.py \
--replace '/usr/share/mkchromecast/nodejs/' '${placeholder "out"}/share/mkchromecast/nodejs/'
2021-01-15 13:21:58 +00:00
'' + lib.optionalString stdenv.isDarwin ''
2019-03-07 13:36:41 +00:00
install -Dm 755 -t $out/bin bin/audiodevice
substituteInPlace $out/lib/${python3Packages.python.libPrefix}/site-packages/mkchromecast/audio_devices.py \
--replace './bin/audiodevice' '${placeholder "out"}/bin/audiodevice'
'';
meta = with lib; {
2019-03-07 13:36:41 +00:00
homepage = "https://mkchromecast.com/";
description = "Cast macOS and Linux Audio/Video to your Google Cast and Sonos Devices";
license = licenses.mit;
maintainers = with maintainers; [ shou ];
2022-11-26 01:16:27 +00:00
mainProgram = "mkchromecast";
2019-03-07 13:36:41 +00:00
};
}