about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/remarkable/restream/default.nix
blob: c5958aff724c593c5f50cb0a9a70b3639a159eb3 (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
53
54
55
56
57
58
{ lib
, stdenv
, lz4
, ffmpeg-full
, fetchFromGitHub
, openssh
, netcat
, makeWrapper
}:

stdenv.mkDerivation rec {
  pname = "restream";
  version = "1.3.1";

  src = fetchFromGitHub {
    owner = "rien";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-AXHKOfdIM3LsHF6u3M/lMhhcuPZADoEal7de3zlx7L4=";
  };

  dontConfigure = true;
  dontBuild = true;

  installPhase = ''
    runHook preInstall

    install -D ${src}/restream.arm.static $out/libexec/restream.arm.static
    install -D ${src}/reStream.sh $out/bin/restream

    runHook postInstall
  '';

  postInstall = let
    deps = [
      # `ffmpeg-full` is used here to bring in `ffplay`, which is used
      # to display the reMarkable framebuffer
      ffmpeg-full
      lz4
      openssh
      # Libressl netcat brings in `nc` which used for --uncompressed mode.
      netcat
    ];
  in ''
    # This `sed` command has the same effect as `wrapProgram`, except
    # without .restream-wrapped store paths appearing everywhere.
    sed -i \
      '2i export PATH=$PATH''${PATH:+':'}${lib.makeBinPath deps}' \
      "$out/bin/restream"
  '';

  meta = with lib; {
    description = "reMarkable screen sharing over SSH";
    homepage = "https://github.com/rien/reStream";
    license = licenses.mit;
    maintainers = [ maintainers.cpcloud ];
  };
}