about summary refs log tree commit diff
path: root/pkgs/applications/video/mpv/scripts/mpv-cheatsheet.nix
blob: a15f54d01ef224d6911ad5190b7718aeadb386d6 (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
{ lib
, fetchFromGitHub
, gitUpdater
, nodePackages
, stdenvNoCC
}:
stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "mpv-cheatsheet";
  version = "0.30.0.2";

  src = fetchFromGitHub {
    owner = "ento";
    repo = "mpv-cheatsheet";
    rev = "v${finalAttrs.version}";
    hash = "sha256-MWK0CYto3zgn3fivmL43tvgZn6XrjPxKLp0lgTFdplM=";
  };
  passthru.updateScript = gitUpdater { rev-prefix = "v"; };

  nativeBuildInputs = [
    nodePackages.browserify
  ];

  buildPhase = ''
    runHook preBuild

    make dist/${finalAttrs.passthru.scriptName}

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    install -D dist/${finalAttrs.passthru.scriptName} $out/share/mpv/scripts/${finalAttrs.passthru.scriptName}

    runHook postInstall
  '';


  passthru.scriptName = "cheatsheet.js";

  meta = with lib; {
    description = "mpv script for looking up keyboard shortcuts";
    homepage = "https://github.com/ento/mpv-cheatsheet";
    license = licenses.mit;
    maintainers = with maintainers; [ ambroisie ];
  };
})