depot/third_party/nixpkgs/pkgs/by-name/bi/bilibili/package.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

51 lines
1.3 KiB
Nix

{ lib
, stdenv
, fetchurl
, electron
, zstd
, makeWrapper
}:
stdenv.mkDerivation rec {
pname = "bilibili";
version = "1.13.5-2";
src = fetchurl {
url = "https://github.com/msojocs/bilibili-linux/releases/download/v${version}/io.github.msojocs.bilibili_${version}_amd64.deb";
hash = "sha256-4p5izaQsax4i2/AnjivDVoY205ITmEx48GhblPOZDjk=";
};
unpackPhase = ''
runHook preUnpack
ar x $src
tar -I ${zstd}/bin/zstd -xvf data.tar.zst
runHook postUnpack
'';
nativeBuildInputs = [ makeWrapper ];
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
makeWrapper ${electron}/bin/electron $out/bin/bilibili \
--argv0 "bilibili" \
--add-flags "$out/opt/app.asar"
runHook postInstall
'';
meta = with lib; {
description = "Electron-based bilibili desktop client";
homepage = "https://github.com/msojocs/bilibili-linux";
license = with licenses; [ unfree mit ];
maintainers = with maintainers; [ jedsek kashw2 ];
platforms = [ "x86_64-linux" ];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
mainProgram = "bilibili";
};
}