eufon/default.nix

95 lines
2.3 KiB
Nix
Raw Permalink Normal View History

{ stdenv
, callPackage
2022-05-18 09:33:37 +00:00
, debug ? false
2022-04-26 22:01:30 +00:00
, fetchFromGitHub
2022-04-26 20:14:46 +00:00
, fennel
2022-04-27 12:26:54 +00:00
, glib-networking
2022-04-26 21:13:37 +00:00
, gobject-introspection
2022-04-27 12:26:54 +00:00
, webkitgtk
2022-04-26 21:13:37 +00:00
, gtk3
, gtk-layer-shell
, lua5_3
2022-07-11 23:17:22 +00:00
, socat
, cpio
, makeWrapper
} :
let
2022-04-26 22:01:30 +00:00
lua = lua5_3;
2022-04-26 20:14:46 +00:00
fennel_ = (fennel.override { lua = lua5_3; });
2022-04-26 22:01:30 +00:00
luaDbusProxy = callPackage ./lua-dbus-proxy.nix {
inherit (lua.pkgs) lgi buildLuaPackage;
inherit lua;
};
2022-04-27 12:26:54 +00:00
glib_networking_gio = "${glib-networking}/lib/gio/modules";
2022-04-26 22:01:30 +00:00
inifile = lua.pkgs.buildLuaPackage rec {
pname = "inifile";
name = "${pname}-${version}";
version = "1.0.2";
src = fetchFromGitHub {
owner = "bartbes";
repo = "inifile";
rev = "f0b41a8a927f3413310510121c5767021957a4e0";
sha256 = "1ry0q238vbp8wxwy4qp1aychh687lvbckcf647pmc03rwkakxm4r";
};
buildPhase = ":";
installPhase = ''
mkdir -p "$out/share/lua/${lua.luaversion}"
cp inifile.lua "$out/share/lua/${lua.luaversion}/"
'';
};
2022-04-26 20:14:46 +00:00
luaWithPackages = lua5_3.withPackages (ps: with ps; [
(toLuaModule fennel_)
2022-04-26 22:01:30 +00:00
inifile
luafilesystem
2022-04-26 21:13:37 +00:00
lgi
luaposix
2022-04-26 22:01:30 +00:00
luaDbusProxy
penlight
2022-04-26 20:14:46 +00:00
]);
2022-05-18 09:33:37 +00:00
kiwmi = callPackage ./kiwmi.nix { lua = lua5_3; inherit debug; };
2022-04-27 12:26:54 +00:00
GIO_EXTRA_MODULES = "${glib-networking}/lib/gio/modules";
in
stdenv.mkDerivation {
pname = "eufon";
version = "0.1";
2022-04-27 12:26:54 +00:00
inherit GIO_EXTRA_MODULES;
2022-04-26 21:13:37 +00:00
buildInputs = [
luaWithPackages
kiwmi
2022-04-27 12:26:54 +00:00
glib-networking
2022-04-26 21:13:37 +00:00
gobject-introspection.dev
gtk-layer-shell
gtk3
2022-04-27 12:26:54 +00:00
webkitgtk
2022-04-26 21:13:37 +00:00
];
nativeBuildInputs = [ cpio makeWrapper ];
2022-04-26 21:13:37 +00:00
2022-07-11 23:17:22 +00:00
installPhase = ''
export LUA_PATH="`lua -e 'print(package.path)'`"
export LUA_CPATH="`lua -e 'print(package.cpath)'`"
2022-07-11 23:17:22 +00:00
mkdir -p $out/bin
2022-08-14 14:07:29 +00:00
find . -name kiwmi -prune \
-o -type l -prune \
-o -name git -prune \
-o -print0 | cpio -0 -v --pass-through $out
substitute bin/eufonctl.sh $out/bin/eufonctl \
2022-07-11 23:17:22 +00:00
--replace SOCAT=socat SOCAT=${socat}/bin/socat
makeWrapper ${kiwmi}/bin/kiwmi $out/bin/eufon \
--set LUA_PATH "$out/?.lua;$LUA_PATH" \
--set LUA_CPATH "$LUA_CPATH" \
--prefix PATH : ${kiwmi}/bin:${luaWithPackages}/bin \
--set EUFON_PATH "$out" \
--set GIO_EXTRA_MODULES "${glib-networking}/lib/gio/modules" \
--set GI_TYPELIB_PATH "$GI_TYPELIB_PATH" \
--add-flags "-c $out/init.lua"
2022-07-11 23:17:22 +00:00
chmod +x $out/bin/eufon
'';
src = ./.;
}