@@ -0,0 +1,47 @@
1+{ stdenv, fetchFromGitHub, pkgconfig, makeWrapper
2+, lua52Packages, libXft, ncurses, readline, zlib }:
3+
4+stdenv.mkDerivation rec {
5+ name = "wordgrinder-${version}";
6+ version = "0.6-db14181";
7+
8+ src = fetchFromGitHub {
9+ repo = "wordgrinder";
10+ owner = "davidgiven";
11+ rev = "db141815e8bd1da6e684a1142a59492e516f3041";
12+ sha256 = "1l1jqzcqiwnc8r1igfi7ay4pzzhdhss81znnmfr4rc1ia8bpdjc2";
13+ };
14+
15+ makeFlags = [
16+ "PREFIX=$(out)"
17+ "LUA_INCLUDE=${lua52Packages.lua}/include"
18+ "LUA_LIB=${lua52Packages.lua}/lib/liblua.so"
19+ ];
20+
21+ nativeBuildInputs = [ pkgconfig makeWrapper ];
22+
23+ buildInputs = [
24+ libXft
25+ lua52Packages.lua
26+ ncurses
27+ readline
28+ zlib
29+ ];
30+
31+ # To be able to find <Xft.h>
32+ NIX_CFLAGS_COMPILE = "-I${libXft.dev}/include/X11";
33+
34+ # Binaries look for LuaFileSystem library (lfs.so) at runtime
35+ postInstall = ''
36+ wrapProgram $out/bin/wordgrinder --set LUA_CPATH "${lua52Packages.luafilesystem}/lib/lua/5.2/lfs.so";
37+ wrapProgram $out/bin/xwordgrinder --set LUA_CPATH "${lua52Packages.luafilesystem}/lib/lua/5.2/lfs.so";
38+ '';
39+
40+ meta = with stdenv.lib; {
41+ description = "Text-based word processor";
42+ homepage = https://cowlark.com/wordgrinder;
43+ license = licenses.mit;
44+ maintainers = with maintainers; [ matthiasbeyer ];
45+ platforms = with stdenv.lib.platforms; linux;
46+ };
47+}