about summary refs log tree commit diff
path: root/pkgs/sternenseemann/schmecgit/default.nix
blob: 982b2c1df92a5b70fc18cbaee7f606029f097187 (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
{ runCommandWith
, stdenv
, lib
, lowdown
, chroma
, substituteAll
}:

let
  src = substituteAll {
    src = ./main.c;
    chroma = "${lib.getBin chroma}/bin/chroma";
    lowdown = "${lib.getBin lowdown}/bin/lowdown";
  };
in

runCommandWith {
  name = "schmecgit";
  inherit stdenv;
  derivationArgs.meta = {
    description = "schmeck it, about and source filter for cgit";
    license = lib.licenses.gpl2Plus;
    platforms = lib.platforms.unix;
  };
} ''
  mkdir -p "$out/bin"

  # compile main executable
  clang -o "$out/bin/schmecgit" -pedantic -Wall -Wextra -Werror -std=c99 ${src}

  # wrapper script for cgit about filter
  cat > "$out/bin/schmecgit-about" <<EOF
  #!${stdenv.shell}
  exec "$out/bin/schmecgit" --about \$@
  EOF
  chmod +x "$out/bin/schmecgit-about"
''