diff options
author | sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> | 2021-04-13 23:24:45 +0200 |
---|---|---|
committer | sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> | 2021-04-13 23:24:45 +0200 |
commit | aeb3813d405eb77e804b350e9f51c88dd4e464c2 (patch) | |
tree | 9591b651a75e3b4bcd7cf8be117068ed90d97bc2 /pkgs/sternenseemann/schmecgit/default.nix | |
parent | c26d6c7199629afd7fdfbc09da3da67cea241181 (diff) |
pkgs/sternenseemann: add schmecgit, a cgit about / source filter
Only does very simple dispatching to pkgs.lowdown and pkgs.chroma, but is at least significantly faster than the default source and about filters bundled with cgit (which is not really a challenge as they use python and pygments). Added to enable my cgit setup until we can have TVL's //tools/cheddar.
Diffstat (limited to 'pkgs/sternenseemann/schmecgit/default.nix')
-rw-r--r-- | pkgs/sternenseemann/schmecgit/default.nix | 37 |
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" +'' |