chromium,chromedriver: 129.0.6668.91 -> 129.0.6668.100
[NixPkgs.git] / pkgs / by-name / ya / yandex-music / package.nix
blob6ee96d54fdd6f90690293637fff57f52c9bf4a7a
2   fetchurl,
3   stdenvNoCC,
4   lib,
5   makeWrapper,
6   p7zip,
7   asar,
8   jq,
9   python3,
10   electron,
11   fetchFromGitHub,
12   electronArguments ? "",
13   trayEnabled ? true,
15 stdenvNoCC.mkDerivation rec {
16   pname = "yandex-music";
17   version = "5.18.2";
19   src = fetchFromGitHub {
20     owner = "cucumber-sp";
21     repo = "yandex-music-linux";
22     rev = "v${version}";
23     hash = "sha256-y+T2ckrnhrOiiPKBUlnvDb4FwrIfbaIXwVi16AoX/bQ=";
24   };
26   nativeBuildInputs = [
27     p7zip
28     asar
29     jq
30     python3
31     makeWrapper
32   ];
34   passthru.updateScript = ./update.sh;
36   ymExe =
37     let
38       ym_info = builtins.fromJSON (builtins.readFile ./ym_info.json);
39     in
40     fetchurl {
41       url = ym_info.ym.exe_link;
42       sha256 = ym_info.ym.exe_sha256;
43     };
45   buildPhase = ''
46     runHook preBuild
47     bash "./repack.sh" -o "./app" "$ymExe"
48     runHook postBuild
49   '';
51   installPhase = ''
52     runHook preInstall
54     mkdir -p "$out/share/nodejs"
55     mv app/yandex-music.asar "$out/share/nodejs"
57     CONFIG_FILE="$out/share/yandex-music.conf"
58     echo "TRAY_ENABLED=${if trayEnabled then "1" else "0"}" >> "$CONFIG_FILE"
59     echo "ELECTRON_ARGS=\"${electronArguments}\"" >> "$CONFIG_FILE"
62     install -Dm755 "$src/templates/yandex-music.sh" "$out/bin/yandex-music"
63     substituteInPlace "$out/bin/yandex-music"                                  \
64       --replace-fail "%electron_path%" "${electron}/bin/electron"              \
65       --replace-fail "%asar_path%" "$out/share/nodejs/yandex-music.asar"
67     wrapProgram "$out/bin/yandex-music"                                        \
68       --set-default YANDEX_MUSIC_CONFIG "$CONFIG_FILE"
70     install -Dm644 "./app/favicon.png" "$out/share/pixmaps/yandex-music.png"
71     install -Dm644 "./app/favicon.png" "$out/share/icons/hicolor/48x48/apps/yandex-music.png"
72     install -Dm644 "./app/favicon.svg" "$out/share/icons/hicolor/scalable/apps/yandex-music.svg"
74     install -Dm644 "$src/templates/desktop" "$out/share/applications/yandex-music.desktop"
76     runHook postInstall
77   '';
79   meta = {
80     description = "Yandex Music - Personal recommendations, selections for any occasion and new music";
81     homepage = "https://music.yandex.ru/";
82     downloadPage = "https://music.yandex.ru/download/";
83     changelog = "https://github.com/cucumber-sp/yandex-music-linux/releases/tag/v5.13.2";
84     license = lib.licenses.unfree;
85     platforms = lib.platforms.linux;
86     maintainers = with lib.maintainers; [ shved ];
87   };