nixpkgs/pkgs/by-name/bi/bilibili/package.nix

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

74 lines
1.8 KiB
Nix
Raw Normal View History

2024-08-06 14:59:35 +01:00
{
lib,
stdenv,
fetchurl,
2024-08-24 16:03:54 +01:00
electron_30,
dpkg,
2024-08-06 14:59:35 +01:00
makeWrapper,
commandLineArgs ? "",
2023-04-05 14:13:50 +01:00
}:
2024-08-10 02:05:09 +01:00
let
version = "1.14.0-2";
2024-08-10 02:05:09 +01:00
srcs = {
x86_64-linux = fetchurl {
url = "https://github.com/msojocs/bilibili-linux/releases/download/v${version}/io.github.msojocs.bilibili_${version}_amd64.deb";
hash = "sha256-QQMdEpKE7r/fPMaX/yEoaa7KjilhiPMYLRvGPkv1jds=";
};
aarch64-linux = fetchurl {
url = "https://github.com/msojocs/bilibili-linux/releases/download/v${version}/io.github.msojocs.bilibili_${version}_arm64.deb";
hash = "sha256-UaGI4BLhfoYluZpARsj+I0iEmFXYYNfl4JWhBWOOip0=";
};
2023-04-05 14:13:50 +01:00
};
2024-08-10 02:05:09 +01:00
src =
srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
in
stdenv.mkDerivation {
pname = "bilibili";
2024-08-24 16:03:54 +01:00
inherit src version;
2023-04-05 14:13:50 +01:00
unpackPhase = ''
runHook preUnpack
dpkg -x $src ./
2023-04-05 14:13:50 +01:00
runHook postUnpack
'';
nativeBuildInputs = [
makeWrapper
dpkg
];
2023-04-05 14:13:50 +01:00
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp -r usr/share $out/share
sed -i "s|Exec=.*|Exec=$out/bin/bilibili|" $out/share/applications/*.desktop
cp -r opt/apps/io.github.msojocs.bilibili/files/bin/app $out/opt
2024-08-24 16:03:54 +01:00
makeWrapper ${lib.getExe electron_30} $out/bin/bilibili \
2023-04-05 14:13:50 +01:00
--argv0 "bilibili" \
2024-08-06 14:59:35 +01:00
--add-flags "$out/opt/app.asar" \
--add-flags ${lib.escapeShellArg commandLineArgs}
2023-04-05 14:13:50 +01:00
runHook postInstall
'';
2024-08-06 14:59:35 +01:00
meta = {
2023-04-05 14:13:50 +01:00
description = "Electron-based bilibili desktop client";
homepage = "https://github.com/msojocs/bilibili-linux";
2024-08-06 14:59:35 +01:00
license = with lib.licenses; [
unfree
mit
];
maintainers = with lib.maintainers; [
jedsek
kashw2
bot-wxt1221
2024-08-06 14:59:35 +01:00
];
2024-08-10 02:05:09 +01:00
platforms = [
"x86_64-linux"
"aarch64-linux"
];
2024-08-06 14:59:35 +01:00
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
2023-11-27 01:17:53 +00:00
mainProgram = "bilibili";
2023-04-05 14:13:50 +01:00
};
}