yandex-music: init at 5.13.2

Yandex Music - Personal recommendations, selections for any occasion and
new music. This is repacked version of Beta of Yandex Music version for
windows desktop based on electron. The repack process is developing at
[cucumber-sp's](https://github.com/cucumber-sp/yandex-music-linux) project.

Change-Id: I517ba94ceee04cf9f1e13d7c33d5355cbcec0939
This commit is contained in:
Yury Shvedov
2024-08-27 13:04:04 +00:00
committed by Emery Hemingway
parent 98ce61be57
commit f442c0ab52
4 changed files with 152 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
{
"branch": "master",
"commit_hash": "4ac238a00ca0b36e9755e55e54a22d3107ba443c",
"commit_message": "Update packages",
"date": "2024-08-27",
"tag": "v5.13.2"
}
+88
View File
@@ -0,0 +1,88 @@
{
fetchurl,
stdenvNoCC,
lib,
makeWrapper,
p7zip,
asar,
jq,
python3,
electron,
fetchFromGitHub,
electronArguments ? "",
trayEnabled ? true,
}:
stdenvNoCC.mkDerivation rec {
pname = "yandex-music";
version = "5.13.2";
src = fetchFromGitHub {
owner = "cucumber-sp";
repo = "yandex-music-linux";
rev = "v${version}";
hash = "sha256-yQX2GEulAQ02BndpwAAwGdTYtUlNXCgsCUdmXxPwtKU=";
};
nativeBuildInputs = [
p7zip
asar
jq
python3
makeWrapper
];
passthru.updateScript = ./update.sh;
ymExe =
let
ym_info = builtins.fromJSON (builtins.readFile ./ym_info.json);
in
fetchurl {
url = ym_info.ym.exe_link;
sha256 = ym_info.ym.exe_sha256;
};
buildPhase = ''
runHook preBuild
bash "./repack.sh" -o "./app" "$ymExe"
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p "$out/share/nodejs"
mv app/yandex-music.asar "$out/share/nodejs"
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 "$src/templates/yandex-music.sh" "$out/bin/yandex-music"
substituteInPlace "$out/bin/yandex-music" \
--replace-fail "%electron_path%" "${electron}/bin/electron" \
--replace-fail "%asar_path%" "$out/share/nodejs/yandex-music.asar"
wrapProgram "$out/bin/yandex-music" \
--set-default YANDEX_MUSIC_CONFIG "$CONFIG_FILE"
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"
install -Dm644 "$src/templates/desktop" "$out/share/applications/yandex-music.desktop"
runHook postInstall
'';
meta = {
description = "Yandex Music - Personal recommendations, selections for any occasion and new music";
homepage = "https://music.yandex.ru/";
downloadPage = "https://music.yandex.ru/download/";
changelog = "https://github.com/cucumber-sp/yandex-music-linux/releases/tag/v5.13.2";
license = lib.licenses.unfree;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ shved ];
};
}
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p common-updater-scripts fd jq
set -eou pipefail
OWNER="cucumber-sp"
REPO="yandex-music-linux"
URL="https://api.github.com/repos/$OWNER/$REPO"
RAW="https://raw.githubusercontent.com/$OWNER/$REPO"
latest_release="$(curl --silent "$URL/releases/latest")"
latest_tag="$(curl --silent "$URL/tags?per_page=1")"
commit_hash="$(jq -r '.[0].commit.sha' <<<"$latest_tag")"
latest_commit="$(curl --silent "$URL/commits/$commit_hash"'')"
commit_message="$(jq -r '.commit.message' <<<"$latest_commit")"
tag=$(jq -r '.tag_name' <<<"$latest_release")
# drop 'v' prefix
version="${tag#v}"
branch=$(jq -r '.target_commitish' <<<"$latest_release")
date=$(jq -r '.created_at' <<<"$latest_release")
# truncate time
date=${date%T*}
# update version; otherwise fail
update-source-version yandex-music "$version" --ignore-same-hash
# set yandex-music dir
dir="pkgs/by-name/ya/yandex-music"
echo -e '{
"branch": "'"$branch"'",
"commit_hash": "'"$commit_hash"'",
"commit_message": "'"$commit_message"'",
"date": "'"$date"'",
"tag": "'"$tag"'"
}' >"$dir/info.json" || echo "Please run the script in the root of the Nixpkgs repo"
curl --silent "$RAW/$commit_hash/utility/version_info.json" |\
jq . > "$dir/ym_info.json" ||\
echo "Please run the script in the root of the Nixpkgs repo"
+14
View File
@@ -0,0 +1,14 @@
{
"ym": {
"version": "5.13.2",
"exe_name": "Yandex_Music_x64_5.13.2.exe",
"exe_link": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.13.2.exe",
"exe_sha256": "ac7a489a59e074358559f544a26143ca81a6bdfa41481242f3419b76eaffdb0b"
},
"electron": {
"version": "29.4.6",
"x64": "https://github.com/electron/electron/releases/download/v29.4.6/electron-v29.4.6-linux-x64.zip",
"armv7l": "https://github.com/electron/electron/releases/download/v29.4.6/electron-v29.4.6-linux-armv7l.zip",
"arm64": "https://github.com/electron/electron/releases/download/v29.4.6/electron-v29.4.6-linux-arm64.zip"
}
}