1{
2 fetchFromGitHub,
3 buildLuarocksPackage,
4 lua,
5 pkg-config,
6 lib,
7 replaceVars,
8 zenity,
9}:
10
11buildLuarocksPackage {
12 pname = "nfd";
13 version = "scm-1";
14
15 src = fetchFromGitHub {
16 owner = "Vexatos";
17 repo = "nativefiledialog";
18 rev = "2f74a5758e8df9b27158d444953697bc13fe90d8";
19 sha256 = "1f52mb0s9zrpsqjp10bx92wzqmy1lq7fg1fk1nd6xmv57kc3b1qv";
20 fetchSubmodules = true;
21 };
22
23 # use zenity because default gtk impl just crashes
24 patches = [
25 (replaceVars ./zenity.patch {
26 inherit zenity;
27 })
28 ];
29 knownRockspec = "lua/nfd-scm-1.rockspec";
30
31 luarocksConfig.variables.LUA_LIBDIR = "${lua}/lib";
32 nativeBuildInputs = [ pkg-config ];
33
34 postInstall = ''
35 find $out -name nfd_zenity.so -execdir mv {} nfd.so \;
36 '';
37
38 doInstallCheck = true;
39 installCheckInputs = [ lua.pkgs.busted ];
40 installCheckPhase = ''
41 busted lua/spec/
42 '';
43
44 meta = {
45 description = "Tiny, neat Lua library that invokes native file open and save dialogs";
46 homepage = "https://github.com/Alloyed/nativefiledialog/tree/master/lua";
47 license = lib.licenses.zlib;
48 maintainers = [ lib.maintainers.scoder12 ];
49 broken = lua.luaversion != "5.1";
50 };
51}