2024-01-15 10:52:43 +03:00
|
|
|
{ fetchurl
|
2024-01-31 23:49:38 +03:00
|
|
|
, stdenvNoCC
|
|
|
|
, lib
|
|
|
|
, makeWrapper
|
2024-01-15 10:52:43 +03:00
|
|
|
|
|
|
|
, p7zip
|
|
|
|
, asar
|
|
|
|
, jq
|
2024-02-09 17:35:17 +03:00
|
|
|
, python3
|
2024-01-31 23:49:38 +03:00
|
|
|
, electron
|
2024-01-15 10:52:43 +03:00
|
|
|
|
2024-01-31 23:49:38 +03:00
|
|
|
, ymExe ? null
|
2024-05-22 14:23:12 +03:00
|
|
|
, electronArguments ? ""
|
|
|
|
, trayEnabled ? false
|
2024-01-15 10:52:43 +03:00
|
|
|
}:
|
|
|
|
let
|
2024-02-09 15:07:50 +03:00
|
|
|
version_info = with builtins; fromJSON (readFile ../utility/version_info.json);
|
2024-01-31 23:49:38 +03:00
|
|
|
in
|
|
|
|
stdenvNoCC.mkDerivation
|
|
|
|
{
|
2024-02-14 14:07:10 +03:00
|
|
|
name = "yandex-music";
|
2024-02-18 21:00:32 +03:00
|
|
|
inherit (version_info.ym) version;
|
2024-01-31 23:49:38 +03:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
p7zip
|
|
|
|
asar
|
|
|
|
jq
|
2024-02-09 17:35:17 +03:00
|
|
|
python3
|
2024-01-31 23:49:38 +03:00
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
|
|
|
repack = ./../repack.sh;
|
2024-02-09 17:25:54 +03:00
|
|
|
patches = ./../patches;
|
|
|
|
utility = ./../utility;
|
2024-03-07 22:16:21 +03:00
|
|
|
icons = ./../icons;
|
2024-01-31 23:49:38 +03:00
|
|
|
desktopItem = ../templates/desktop;
|
2024-05-22 14:23:12 +03:00
|
|
|
ymScript = ../templates/yandex-music.sh;
|
2024-01-31 23:49:38 +03:00
|
|
|
src =
|
|
|
|
if ymExe != null
|
|
|
|
then ymExe
|
|
|
|
else
|
|
|
|
fetchurl {
|
2024-02-18 21:00:32 +03:00
|
|
|
url = version_info.ym.exe_link;
|
|
|
|
sha256 = version_info.ym.exe_sha256;
|
2024-01-31 23:49:38 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
unpackPhase = ''
|
2024-02-09 17:25:54 +03:00
|
|
|
cp -r $repack ./repack.sh
|
|
|
|
cp -r $patches ./patches
|
|
|
|
cp -r $utility ./utility
|
2024-03-07 22:16:21 +03:00
|
|
|
cp -r $icons ./icons
|
2024-02-11 15:07:39 +03:00
|
|
|
bash "./repack.sh" -o "./app" "$src"
|
2024-01-15 10:52:43 +03:00
|
|
|
'';
|
2024-02-09 17:25:54 +03:00
|
|
|
dontPatch = true;
|
2024-01-31 23:49:38 +03:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out/share/nodejs"
|
2024-02-14 14:07:10 +03:00
|
|
|
mv app/yandex-music.asar "$out/share/nodejs"
|
2024-01-31 23:49:38 +03:00
|
|
|
|
2024-05-22 14:23:12 +03:00
|
|
|
CONFIG_FILE="$out/share/yandex-music.conf"
|
|
|
|
echo "TRAY_ENABLED=${if trayEnabled then "1" else "0"}" >> "$CONFIG_FILE"
|
|
|
|
echo "ELECTRON_ARGS=\"${electronArguments}\"" >> "$CONFIG_FILE"
|
|
|
|
|
|
|
|
|
|
|
|
install -Dm755 "$ymScript" "$out/bin/yandex-music"
|
|
|
|
sed -i "s|%electron_path%|${electron}/bin/electron|g" "$out/bin/yandex-music"
|
|
|
|
sed -i "s|%asar_path%|$out/share/nodejs/yandex-music.asar|g" "$out/bin/yandex-music"
|
|
|
|
|
|
|
|
wrapProgram "$out/bin/yandex-music" \
|
|
|
|
--set-default YANDEX_MUSIC_CONFIG "$CONFIG_FILE"
|
2024-01-31 23:49:38 +03:00
|
|
|
|
2024-02-21 08:14:32 +03:00
|
|
|
install -Dm644 "./app/favicon.png" "$out/share/pixmaps/yandex-music.png"
|
|
|
|
install -Dm644 "./app/favicon.png" "$out/share/icons/hicolor/48x48/apps/yandex-music.png"
|
|
|
|
install -Dm644 "./app/favicon.svg" "$out/share/icons/hicolor/scalable/apps/yandex-music.svg"
|
2024-01-31 23:49:38 +03:00
|
|
|
|
2024-02-21 08:14:32 +03:00
|
|
|
install -Dm644 "$desktopItem" "$out/share/applications/yandex-music.desktop"
|
2024-01-31 23:49:38 +03:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Yandex Music - Personal recommendations, selections for any occasion and new music";
|
|
|
|
homepage = "https://music.yandex.ru/";
|
|
|
|
downloadPage = "https://music.yandex.ru/download/";
|
|
|
|
license = lib.licenses.unfree;
|
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
|
|
|
maintainers = [
|
|
|
|
{
|
|
|
|
name = "Yury Shvedov";
|
|
|
|
email = "mestofel13@gmail.com";
|
|
|
|
github = "ein-shved";
|
|
|
|
githubId = 3513222;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
github = "cucumber-sp";
|
|
|
|
githubId = 100789522;
|
|
|
|
name = "Andrey Onishchenko";
|
|
|
|
}
|
|
|
|
];
|
2024-01-15 10:52:43 +03:00
|
|
|
};
|
|
|
|
}
|