about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/bililiverecorder/default.nix
blob: 222d20637c51260bb742626e3ccfe289b358f995 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{ lib
, stdenv
, fetchzip
, makeWrapper
, dotnetCorePackages
}:

let
  pname = "bililiverecorder";

  dotnet = with dotnetCorePackages; combinePackages [
    runtime_6_0
    aspnetcore_6_0
  ];

  version = "2.11.1";
  hash = "sha256-GY6YRgebWeJtjAIm64Pf8wx6pUdZjbevNzKRdyPi1ow=";

in
stdenv.mkDerivation {
  inherit pname version;

  src = fetchzip {
    url = "https://github.com/BililiveRecorder/BililiveRecorder/releases/download/v${version}/BililiveRecorder-CLI-any.zip";
    stripRoot = false;
    inherit hash;
  };

  nativeBuildInputs = [ makeWrapper ];

  installPhase = ''
    runHook preInstall

    mkdir -p $out/{bin,share/${pname}-${version}}
    cp -r * $out/share/${pname}-${version}/.

    makeWrapper "${dotnet}/bin/dotnet" $out/bin/BililiveRecorder \
      --add-flags "$out/share/${pname}-${version}/BililiveRecorder.Cli.dll"

    runHook postInstall
  '';

  meta = with lib; {
    description = "A convenient free open source bilibili live recording tool";
    homepage = "https://rec.danmuji.org/";
    changelog = "https://github.com/BililiveRecorder/BililiveRecorder/releases/tag/${version}";
    mainProgram = "BililiveRecorder";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ zaldnoay ];
    platforms = platforms.unix;
  };
}