luaPackages.nfd: init at scm-1
This commit is contained in:
parent
d6417bd306
commit
91c80faea0
3 changed files with 93 additions and 0 deletions
41
pkgs/development/lua-modules/nfd/default.nix
Normal file
41
pkgs/development/lua-modules/nfd/default.nix
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{ fetchFromGitHub, buildLuarocksPackage, lua, maintainers, pkg-config
|
||||||
|
, substituteAll, zenity }:
|
||||||
|
|
||||||
|
buildLuarocksPackage {
|
||||||
|
pname = "nfd";
|
||||||
|
version = "scm-1";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "Vexatos";
|
||||||
|
repo = "nativefiledialog";
|
||||||
|
rev = "2f74a5758e8df9b27158d444953697bc13fe90d8";
|
||||||
|
sha256 = "1f52mb0s9zrpsqjp10bx92wzqmy1lq7fg1fk1nd6xmv57kc3b1qv";
|
||||||
|
fetchSubmodules = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# use zenity because default gtk impl just crashes
|
||||||
|
patches = [
|
||||||
|
(substituteAll {
|
||||||
|
src = ./zenity.patch;
|
||||||
|
inherit zenity;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
rockspecDir = "lua";
|
||||||
|
|
||||||
|
extraVariables.LUA_LIBDIR = "${lua}/lib";
|
||||||
|
nativeBuildInputs = [ pkg-config ];
|
||||||
|
|
||||||
|
fixupPhase = ''
|
||||||
|
find $out -name nfd_zenity.so -execdir mv {} nfd.so \;
|
||||||
|
'';
|
||||||
|
|
||||||
|
disabled = with lua; (luaversion != "5.1");
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description =
|
||||||
|
"A tiny, neat lua library that portably invokes native file open and save dialogs.";
|
||||||
|
homepage = "https://github.com/Alloyed/nativefiledialog/tree/master/lua";
|
||||||
|
license.fullName = "zlib";
|
||||||
|
maintainers = [ maintainers.scoder12 ];
|
||||||
|
};
|
||||||
|
}
|
47
pkgs/development/lua-modules/nfd/zenity.patch
Normal file
47
pkgs/development/lua-modules/nfd/zenity.patch
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
diff --git a/lua/Makefile.linux b/lua/Makefile.linux
|
||||||
|
index 9f5aa68..77660d4 100644
|
||||||
|
--- a/lua/Makefile.linux
|
||||||
|
+++ b/lua/Makefile.linux
|
||||||
|
@@ -37,5 +37,5 @@ nfd_zenity.o: src/nfd_zenity.c
|
||||||
|
clean:
|
||||||
|
rm nfd_common.o nfd_gtk.o nfd_wrap_lua.o nfd.so
|
||||||
|
|
||||||
|
-install: nfd.so
|
||||||
|
- cp nfd.so $(INST_LIBDIR)
|
||||||
|
+install:
|
||||||
|
+ cp nfd*.so $(INST_LIBDIR)
|
||||||
|
diff --git a/lua/nfd-scm-1.rockspec b/lua/nfd-scm-1.rockspec
|
||||||
|
index 503399d..2d0a7da 100644
|
||||||
|
--- a/lua/nfd-scm-1.rockspec
|
||||||
|
+++ b/lua/nfd-scm-1.rockspec
|
||||||
|
@@ -17,9 +17,6 @@ supported_platforms = { "linux", "macosx", "windows" }
|
||||||
|
external_dependencies = {
|
||||||
|
platforms = {
|
||||||
|
linux = {
|
||||||
|
- gtk3 = {
|
||||||
|
- library = "gtk-3",
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -28,6 +25,7 @@ build = {
|
||||||
|
linux = {
|
||||||
|
type = "make",
|
||||||
|
makefile = "lua/Makefile.linux",
|
||||||
|
+ build_target = "nfd_zenity.so",
|
||||||
|
build_variables = {
|
||||||
|
CFLAGS="$(CFLAGS)",
|
||||||
|
LIBFLAG="$(LIBFLAG)",
|
||||||
|
diff --git a/src/nfd_zenity.c b/src/nfd_zenity.c
|
||||||
|
index 43ccc6d..3fcdea0 100644
|
||||||
|
--- a/src/nfd_zenity.c
|
||||||
|
+++ b/src/nfd_zenity.c
|
||||||
|
@@ -109,6 +109,8 @@ ZenityCommon(char** command,
|
||||||
|
command[i] = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // caller always sets command[0] to "zenity"
|
||||||
|
+ command[0] = strdup("@zenity@/bin/zenity");
|
||||||
|
AddFiltersToCommandArgs(command, commandLen, filterList);
|
||||||
|
|
||||||
|
int byteCount = 0;
|
|
@ -104,6 +104,11 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nfd = callPackage ../development/lua-modules/nfd {
|
||||||
|
inherit (lib) maintainers;
|
||||||
|
inherit (pkgs.gnome) zenity;
|
||||||
|
};
|
||||||
|
|
||||||
vicious = luaLib.toLuaModule( stdenv.mkDerivation rec {
|
vicious = luaLib.toLuaModule( stdenv.mkDerivation rec {
|
||||||
pname = "vicious";
|
pname = "vicious";
|
||||||
version = "2.5.1";
|
version = "2.5.1";
|
||||||
|
|
Loading…
Reference in a new issue