0
0
mirror of https://github.com/cucumber-sp/yandex-music-linux.git synced 2024-12-24 14:34:39 +03:00
yandex-music-linux/nix/default.nix

82 lines
1.9 KiB
Nix
Raw Normal View History

{ fetchurl
, stdenvNoCC
, lib
, makeWrapper
, p7zip
, asar
, jq
, electron
, ymExe ? null
, fixQuit ? true
}:
let
version_info = with builtins; fromJSON (readFile ../version_info.json);
in
stdenvNoCC.mkDerivation
{
name = "yandexmusic";
inherit (version_info) version;
nativeBuildInputs = [
p7zip
asar
jq
makeWrapper
];
repack = ./../repack.sh;
desktopItem = ../templates/desktop;
src =
if ymExe != null
then ymExe
else
fetchurl {
url = version_info.exe_link;
sha256 = version_info.exe_sha256;
};
unpackPhase = ''
bash "$repack" ${if !fixQuit then "-q" else ""} -o "./app" "$src"
'';
installPhase = ''
mkdir -p "$out/share/nodejs"
mv app/yandexmusic.asar "$out/share/nodejs"
# use makeWrapper on electron binary to make it call our asar package
makeWrapper "${electron}/bin/electron" "$out/bin/yandexmusic" \
--add-flags "$out/share/nodejs/yandexmusic.asar"
mkdir -p "$out/share/pixmaps"
mkdir -p "$out/share/icons/hicolor/48x48/apps/"
cp ./app/favicon.png "$out/share/icons/hicolor/48x48/apps/yandexmusic.png"
ln -s ../icons/hicolor/48x48/apps/yandexmusic.png "$out/share/pixmaps"
mkdir -p $out/share/applications
cp $desktopItem $out/share/applications/yandexmusic.desktop
'';
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";
}
];
};
}