about summary refs log tree commit diff
path: root/pkgs/by-name/de/decker/package.nix
blob: 4ce73c54b7a58d0482dfb9683f904f4029cce1c9 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{ lib
, stdenv
, fetchFromGitHub
, SDL2
, SDL2_image
, unixtools
, multimarkdown
}:

stdenv.mkDerivation rec {
  pname = "decker";
  version = "1.41";

  src = fetchFromGitHub {
    owner = "JohnEarnest";
    repo = "Decker";
    rev = "v${version}";
    hash = "sha256-AnWFAa96/lO5to7mVzHGkyzJ8U+2A9u9N1w91vHDsFo=";
  };

  buildInputs = [
    SDL2
    SDL2_image
    multimarkdown
    unixtools.xxd
  ];

  doCheck = true;

  postPatch = ''
    patchShebangs ./scripts
  '';

  buildPhase = ''
    runHook preBuild
    make lilt
    make decker
    make docs
    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    install -Dm0755 ./c/build/lilt -t $out/bin
    install -Dm0755 ./c/build/decker -t $out/bin
    install -Dm0644 ./syntax/vim/ftdetect/lil.vim -t $out/share/vim-plugins/decker/ftdetect
    install -Dm0644 ./syntax/vim/syntax/lil.vim -t $out/share/vim-plugins/decker/syntax

    # Fixing the permissions of the installed files on the documentation.
    chmod a-x ./docs/images/* \
              ./docs/*.md \
              ./examples/decks/*.deck \
              ./examples/lilt/*.lil

    # This example has a shebang so we'll leave it as an executable.
    chmod a+x ./examples/lilt/podcasts.lil

    mkdir -p $out/share/doc/decker
    cp -r ./docs/*.html ./docs/images ./examples $out/share/doc/decker

    runHook postInstall
  '';

  checkPhase = ''
    runHook preCheck
    make test
    runHook postCheck
  '';

  meta = with lib; {
    homepage = "https://beyondloom.com/decker";
    description = "Multimedia platform for creating and sharing interactive documents";
    license = licenses.mit;
    mainProgram = "decker";
    platforms = platforms.all;
    maintainers = with maintainers; [ foo-dogsquared ];
  };
}