about summary refs log tree commit diff
path: root/pkgs/sternenseemann/schmecgit/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/sternenseemann/schmecgit/default.nix')
-rw-r--r--pkgs/sternenseemann/schmecgit/default.nix37
1 files changed, 37 insertions, 0 deletions
diff --git a/pkgs/sternenseemann/schmecgit/default.nix b/pkgs/sternenseemann/schmecgit/default.nix
new file mode 100644
index 00000000..982b2c1d
--- /dev/null
+++ b/pkgs/sternenseemann/schmecgit/default.nix
@@ -0,0 +1,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"
+''