about summary refs log tree commit diff
path: root/pkgs/by-name/bi/bilibili/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/bi/bilibili/package.nix')
-rw-r--r--pkgs/by-name/bi/bilibili/package.nix74
1 files changed, 48 insertions, 26 deletions
diff --git a/pkgs/by-name/bi/bilibili/package.nix b/pkgs/by-name/bi/bilibili/package.nix
index b3f7a7b7adaa..14b3e0348370 100644
--- a/pkgs/by-name/bi/bilibili/package.nix
+++ b/pkgs/by-name/bi/bilibili/package.nix
@@ -1,29 +1,40 @@
-{ lib
-, stdenv
-, fetchurl
-, electron
-, zstd
-, makeWrapper
+{
+  lib,
+  stdenv,
+  fetchurl,
+  electron_30,
+  dpkg,
+  makeWrapper,
+  commandLineArgs ? "",
 }:
-
-stdenv.mkDerivation rec {
-  pname = "bilibili";
-  version = "1.14.0-1";
-  src = fetchurl {
-    url = "https://github.com/msojocs/bilibili-linux/releases/download/v${version}/io.github.msojocs.bilibili_${version}_amd64.deb";
-    hash = "sha256-4+DGL/DNR3wLFUff17OquAM6dOkcsXFNeCqA7ITtCaI=";
+let
+  version = "1.14.0-2";
+  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=";
+    };
   };
-
+  src =
+    srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
+in
+stdenv.mkDerivation {
+  pname = "bilibili";
+  inherit src version;
   unpackPhase = ''
     runHook preUnpack
-
-    ar x $src
-    tar -I ${zstd}/bin/zstd -xvf data.tar.zst
-
+    dpkg -x $src ./
     runHook postUnpack
   '';
 
-  nativeBuildInputs = [ makeWrapper ];
+  nativeBuildInputs = [
+    makeWrapper
+    dpkg
+  ];
 
   installPhase = ''
     runHook preInstall
@@ -32,20 +43,31 @@ stdenv.mkDerivation rec {
     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 \
+    makeWrapper ${lib.getExe electron_30} $out/bin/bilibili \
       --argv0 "bilibili" \
-      --add-flags "$out/opt/app.asar"
+      --add-flags "$out/opt/app.asar" \
+      --add-flags ${lib.escapeShellArg commandLineArgs}
 
     runHook postInstall
   '';
 
-  meta = with lib; {
+  meta = {
     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 ];
+    license = with lib.licenses; [
+      unfree
+      mit
+    ];
+    maintainers = with lib.maintainers; [
+      jedsek
+      kashw2
+      bot-wxt1221
+    ];
+    platforms = [
+      "x86_64-linux"
+      "aarch64-linux"
+    ];
+    sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
     mainProgram = "bilibili";
   };
 }