nixpkgs/pkgs/by-name/ye/yesplaymusic/package.nix

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

130 lines
3.0 KiB
Nix
Raw Normal View History

2023-01-17 08:24:54 +00:00
{ lib
, stdenv
, fetchurl
2024-03-21 14:31:16 +00:00
, _7zz
2023-01-17 08:24:54 +00:00
, dpkg
, autoPatchelfHook
, wrapGAppsHook
, makeWrapper
, alsa-lib
, at-spi2-atk
, cups
, nspr
, nss
, mesa # for libgbm
, xorg
, xdg-utils
, libdrm
, libnotify
, libsecret
, libuuid
, gtk3
, systemd
}:
let
2023-02-01 10:56:43 +00:00
pname = "yesplaymusic";
2024-03-21 14:31:16 +00:00
version = "0.4.8-2";
2023-01-17 08:24:54 +00:00
2024-03-21 14:31:16 +00:00
srcs = let
version' = lib.head (lib.splitString "-" version);
in {
2023-01-17 08:24:54 +00:00
x86_64-linux = fetchurl {
2024-03-21 14:31:16 +00:00
url = "https://github.com/qier222/YesPlayMusic/releases/download/v${version}/yesplaymusic_${version'}_amd64.deb";
hash = "sha256-iTWi+tZGUQU7J1mcmMdlWXSKpYGy4mMAeq9CN9fhnZ8=";
2023-01-17 08:24:54 +00:00
};
aarch64-linux = fetchurl {
2024-03-21 14:31:16 +00:00
url = "https://github.com/qier222/YesPlayMusic/releases/download/v${version}/yesplaymusic_${version'}_arm64.deb";
hash = "sha256-PP0apybSORqleOBogldgIV1tYZqao8kZ474muAEDpd0";
2023-01-17 08:24:54 +00:00
};
x86_64-darwin = fetchurl {
2024-03-21 14:31:16 +00:00
url = "https://github.com/qier222/YesPlayMusic/releases/download/v${version}/YesPlayMusic-mac-${version'}-x64.dmg";
hash = "sha256-UHnEdoXT/vArSRKXPlfDYUUUMDyF2mnDsmJEjACW2vo=";
2023-01-17 08:24:54 +00:00
};
aarch64-darwin = fetchurl {
2024-03-21 14:31:16 +00:00
url = "https://github.com/qier222/YesPlayMusic/releases/download/v${version}/YesPlayMusic-mac-${version'}-arm64.dmg";
hash = "sha256-FaeumNmkPQYj9Ae2Xw/eKUuezR4bEdni8li+NRU9i1k=";
2023-01-17 08:24:54 +00:00
};
};
src = srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
libraries = [
alsa-lib
at-spi2-atk
cups
nspr
nss
mesa
xorg.libxshmfence
xorg.libXScrnSaver
xorg.libXtst
xdg-utils
libdrm
libnotify
libsecret
libuuid
gtk3
];
meta = with lib; {
description = "A good-looking third-party netease cloud music player";
mainProgram = "yesplaymusic";
2023-01-17 08:24:54 +00:00
homepage = "https://github.com/qier222/YesPlayMusic/";
license = licenses.mit;
maintainers = with maintainers; [ ChaosAttractor ];
platforms = builtins.attrNames srcs;
};
in
if stdenv.isDarwin
then stdenv.mkDerivation {
inherit pname version src meta;
2024-03-21 14:31:16 +00:00
nativeBuildInputs = [ _7zz makeWrapper ];
2023-01-17 08:24:54 +00:00
sourceRoot = ".";
installPhase = ''
2024-03-21 14:31:16 +00:00
runHook preInstall
2023-01-17 08:24:54 +00:00
mkdir -p $out/Applications
cp -r *.app $out/Applications
2024-03-21 14:31:16 +00:00
makeWrapper $out/Applications/YesPlayMusic.app/Contents/MacOS/YesPlayMusic $out/bin/yesplaymusic
runHook postInstall
2023-01-17 08:24:54 +00:00
'';
}
else stdenv.mkDerivation {
inherit pname version src meta;
nativeBuildInputs = [
autoPatchelfHook
wrapGAppsHook
makeWrapper
];
buildInputs = libraries;
runtimeDependencies = [
(lib.getLib systemd)
];
unpackPhase = ''
${dpkg}/bin/dpkg-deb -x $src .
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp -r opt $out/opt
cp -r usr/share $out/share
substituteInPlace $out/share/applications/yesplaymusic.desktop \
--replace "/opt/YesPlayMusic/yesplaymusic" "$out/bin/yesplaymusic"
makeWrapper $out/opt/YesPlayMusic/yesplaymusic $out/bin/yesplaymusic \
--argv0 "yesplaymusic" \
--add-flags "$out/opt/YesPlayMusic/resources/app.asar"
runHook postInstall
'';
}