kde5.startkde: append extra PATH elements; set Qt search paths

This commit is contained in:
Thomas Tuegel 2016-07-15 09:43:35 -05:00
parent 1cb4aacf18
commit 949277ed0a
2 changed files with 40 additions and 14 deletions

View File

@ -1,16 +1,15 @@
{ stdenv, lib, runCommand
, dbus, qttools, socat
, gnugrep, gnused
, kconfig, kinit, kservice
, plasma-workspace
, xmessage, xprop, xsetroot
{
stdenv, lib, runCommand, dbus, qttools, socat, gnugrep, gnused, kconfig,
kinit, kservice, plasma-workspace, xmessage, xprop, xsetroot, qtbase,
qtdeclarative, qtgraphicaleffects, qtquickcontrols, qtscript, qtsvg,
qtx11extras, qtxmlpatterns
}:
let
env = {
inherit (stdenv) shell;
paths = builtins.map (pkg: pkg.out or pkg)
bins = builtins.map (pkg: pkg.out or pkg)
[
dbus qttools socat
gnugrep gnused
@ -18,15 +17,38 @@ let
plasma-workspace
xmessage xprop xsetroot
];
libs = builtins.map (pkg: pkg.out or pkg)
[
qtbase qtdeclarative qtgraphicaleffects qtquickcontrols
qtscript qtsvg qtx11extras qtxmlpatterns
];
};
in runCommand "startkde" env ''
prefix_PATH=
for pkg in $paths; do
addToSearchPath prefix_PATH "$pkg/bin"
addToSearchPath prefix_PATH "$pkg/lib/libexec"
addToSearchPath prefix_PATH "$pkg/lib/libexec/kf5"
# Configure PATH variable
suffixPATH=
for p in $bins; do
addToSearchPath suffixPATH "$p/bin"
addToSearchPath suffixPATH "$p/lib/libexec"
addToSearchPath suffixPATH "$p/lib/libexec/kf5"
done
substitute ${./startkde.sh} "$out" --subst-var shell --subst-var prefix_PATH
# Configure Qt search paths
QT_PLUGIN_PATH=
QML_IMPORT_PATH=
QML2_IMPORT_PATH=
for p in $libs; do
addToSearchPath QT_PLUGIN_PATH "$p/lib/qt5/plugins"
addToSearchPath QML_IMPORT_PATH "$p/lib/qt5/imports"
addToSearchPath QML2_IMPORT_PATH "$p/lib/qt5/qml"
done
substitute ${./startkde.sh} "$out" \
--subst-var shell \
--subst-var suffixPATH \
--subst-var QT_PLUGIN_PATH \
--subst-var QML_IMPORT_PATH \
--subst-var QML2_IMPORT_PATH
chmod +x "$out"
''

View File

@ -1,6 +1,10 @@
#!@shell@
PATH="@prefix_PATH@:$PATH"
PATH="$PATH${PATH:+:}@suffixPATH@"
export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}@QT_PLUGIN_PATH@"
export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}@QML_IMPORT_PATH@"
export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}@QML2_IMPORT_PATH@"
# The KDE icon cache is supposed to update itself
# automatically, but it uses the timestamp on the icon