awesome: Use --search instead of $LUA_PATH/$LUA_CPATH

Instead of polluting the environment with environment variables which
are inherited by processes spawned from awesome, use the command line
argument "--search" to add things to the search path.

cc #33169
This commit is contained in:
Uli Schlachter 2018-01-02 18:24:56 +01:00 committed by Franz Pletz
parent c98eb9e9b9
commit 5465d6f7de
2 changed files with 8 additions and 7 deletions

View File

@ -6,7 +6,11 @@ let
cfg = config.services.xserver.windowManager.awesome;
awesome = cfg.package;
inherit (pkgs.luaPackages) getLuaPath getLuaCPath;
getLuaPath = lib : dir : "${lib}/${dir}/lua/${pkgs.luaPackages.lua.luaversion}";
makeSearchPath = lib.concatMapStrings (path:
" --search " + (getLuaPath path "share") +
" --search " + (getLuaPath path "lib")
);
in
{
@ -46,10 +50,7 @@ in
{ name = "awesome";
start =
''
export LUA_CPATH="${lib.concatStringsSep ";" (map getLuaCPath cfg.luaModules)}"
export LUA_PATH="${lib.concatStringsSep ";" (map getLuaPath cfg.luaModules)}"
${awesome}/bin/awesome &
${awesome}/bin/awesome ${makeSearchPath cfg.luaModules} &
waitPID=$!
'';
};

View File

@ -49,8 +49,8 @@ with luaPackages; stdenv.mkDerivation rec {
postInstall = ''
wrapProgram $out/bin/awesome \
--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
--prefix LUA_CPATH ";" '${lgi}/lib/lua/${lua.luaversion}/?.so' \
--prefix LUA_PATH ";" '${lgi}/share/lua/${lua.luaversion}/?.lua' \
--add-flags '--search ${lgi}/lib/lua/${lua.luaversion}' \
--add-flags '--search ${lgi}/share/lua/${lua.luaversion}' \
--prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
--prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH" \
--prefix PATH : "${stdenv.lib.makeBinPath [ compton unclutter procps iproute coreutils curl alsaUtils findutils xterm ]}"