diff --git a/default.nix b/default.nix index b95556d..69e33e4 100644 --- a/default.nix +++ b/default.nix @@ -1,5 +1,7 @@ { stdenv , callPackage +, fetchFromGitHub + , fennel , gobject-introspection , gtk3 @@ -7,11 +9,38 @@ , lua5_3 } : let + lua = lua5_3; fennel_ = (fennel.override { lua = lua5_3; }); + luaDbusProxy = callPackage ./lua-dbus-proxy.nix { + inherit (lua.pkgs) lgi buildLuaPackage; + inherit lua; + }; + 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}/" + ''; + }; + luaWithPackages = lua5_3.withPackages (ps: with ps; [ (toLuaModule fennel_) + inifile + luafilesystem lgi luaposix + luaDbusProxy + penlight + ]); kiwmi = callPackage ./kiwmi.nix { lua = lua5_3; }; in diff --git a/lua-dbus-proxy.nix b/lua-dbus-proxy.nix new file mode 100644 index 0000000..5e2fd62 --- /dev/null +++ b/lua-dbus-proxy.nix @@ -0,0 +1,29 @@ +{ lua, lgi, buildLuaPackage, fetchFromGitHub }: +let + + simpleName = "dbus_proxy"; + +in +# TODO: add busted and checkPhase? +buildLuaPackage rec { + version = "0.10.2"; + pname = simpleName; # nixpkgs unstable needs this + name = "${pname}-${version}"; # nixpkgs 21.11 needs this + + src = fetchFromGitHub { + owner = "stefano-m"; + repo = "lua-${simpleName}"; + rev = "v${version}"; + sha256 = "0kl8ff1g1kpmslzzf53cbzfl1bmb5cb91w431hbz0z0vdrramh6l"; + }; + + propagatedBuildInputs = [ lgi ]; + + buildPhase = ":"; + + installPhase = '' + mkdir -p "$out/share/lua/${lua.luaversion}" + cp -r src/${pname} "$out/share/lua/${lua.luaversion}/" + ''; + +} diff --git a/rc.fnl b/rc.fnl index d1a3a30..267dd9f 100644 --- a/rc.fnl +++ b/rc.fnl @@ -12,4 +12,5 @@ ;(kiwmi:spawn "swaybg -c '#ff00ff'") (kiwmi:spawn "lua -l fennelrun modeline.fnl") +(kiwmi:spawn "lua -l fennelrun saturn/main.fnl") (kiwmi:spawn "foot") diff --git a/saturn/main.fnl b/saturn/main.fnl index 0050ca3..9518f2c 100644 --- a/saturn/main.fnl +++ b/saturn/main.fnl @@ -14,7 +14,6 @@ ((require :pl.import_into))) (local dbus (require :dbus_proxy)) -(local inspect (require :inspect)) (local lfs (require :lfs)) (local inifile (require :inifile)) (local posix (require :posix))