From 078c88a7a715ed5b0245d46c0ce6776cb5e73a8b Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Fri, 19 May 2017 07:42:08 -0500 Subject: startkde: use absolute paths to required programs The dependency on socat is removed because kwallet setup is deferred to kwallet-pam. --- pkgs/desktops/plasma-5/startkde/default.nix | 62 ++++++++++++------------- pkgs/desktops/plasma-5/startkde/startkde.sh | 72 ++++++++++++----------------- 2 files changed, 61 insertions(+), 73 deletions(-) (limited to 'pkgs/desktops/plasma-5') diff --git a/pkgs/desktops/plasma-5/startkde/default.nix b/pkgs/desktops/plasma-5/startkde/default.nix index 25ebdd7f332c..3b04c037073d 100644 --- a/pkgs/desktops/plasma-5/startkde/default.nix +++ b/pkgs/desktops/plasma-5/startkde/default.nix @@ -1,41 +1,41 @@ { - stdenv, lib, runCommand, dbus, qttools, socat, gnugrep, gnused, kconfig, - kinit, kservice, plasma-workspace, xmessage, xprop, xsetroot, qtbase, - qtdeclarative, qtgraphicaleffects, qtquickcontrols, qtquickcontrols2, - qtscript, qtsvg, qtx11extras, qtxmlpatterns + stdenv, lib, runCommand, substituteAll, dbus, gnugrep, gnused, kconfig, + kinit, kservice, plasma-desktop, plasma-workspace, xmessage, xprop, xrdb, + xsetroot, qttools, }: let - env = { + inherit (lib) getBin getLib; + + script = substituteAll { + src = ./startkde.sh; inherit (stdenv) shell; - bins = builtins.map (pkg: pkg.out or pkg) - [ - dbus qttools socat - gnugrep gnused - kconfig kinit kservice - plasma-workspace - xmessage xprop xsetroot - ]; - libs = builtins.map (pkg: pkg.out or pkg) - [ - qtbase qtdeclarative qtgraphicaleffects qtquickcontrols qtquickcontrols2 - qtscript qtsvg qtx11extras qtxmlpatterns - ]; + kbuildsycoca5 = "${getBin kservice}/bin/kbuildsycoca5"; + sed = "${getBin gnused}/bin/sed"; + kcheckrunning = "${getBin plasma-workspace}/bin/kcheckrunning"; + xmessage = "${getBin xmessage}/bin/xmessage"; + kstartupconfig5 = "${getBin plasma-workspace}/bin/kstartupconfig5"; + kapplymousetheme = "${getBin plasma-desktop}/bin/kapplymousetheme"; + xsetroot = "${getBin xsetroot}/bin/xsetroot"; + xrdb = "${getBin xrdb}/bin/xrdb"; + ksplashqml = "${getBin plasma-workspace}/bin/ksplashqml"; + qdbus = "${getBin qttools}/bin/qdbus"; + xprop = "${getBin xprop}/bin/xprop"; + qtpaths = "${getBin qttools}/bin/qtpaths"; + dbus_update_activation_environment = "${getBin dbus}/bin/dbus-update-activation-environment"; + start_kdeinit_wrapper = "${getLib kinit}/lib/libexec/kf5/start_kdeinit_wrapper"; + kwrapper5 = "${getBin kinit}/bin/kwrapper5"; + ksmserver = "${getBin plasma-workspace}/bin/ksmserver"; + kreadconfig5 = "${getBin kconfig}/bin/kreadconfig5"; + kdeinit5_shutdown = "${getBin kinit}/bin/kdeinit5_shutdown"; }; -in runCommand "startkde" env '' - - # 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 +in - substitute ${./startkde.sh} "$out" \ - --subst-var shell \ - --subst-var suffixPATH - chmod +x "$out" +runCommand "startkde.sh" +{ preferLocalBuild = true; allowSubstitutes = false; } +'' + cp ${script} $out + chmod +x $out '' diff --git a/pkgs/desktops/plasma-5/startkde/startkde.sh b/pkgs/desktops/plasma-5/startkde/startkde.sh index 53e7fbb05694..f8b4f4844e23 100755 --- a/pkgs/desktops/plasma-5/startkde/startkde.sh +++ b/pkgs/desktops/plasma-5/startkde/startkde.sh @@ -1,10 +1,6 @@ #!@shell@ -PATH="$PATH${PATH:+:}@suffixPATH@" - -echo "NIX_PROFILES=\"$NIX_PROFILES\"" - -kbuildsycoca5 +@kbuildsycoca5@ # Set the default GTK 2 theme if ! [ -e $HOME/.gtkrc-2.0 ] \ @@ -30,6 +26,7 @@ fi if ! [ -e $HOME/.config/gtk-3.0/settings.ini ] \ && [ -e /run/current-system/sw/share/themes/Breeze/gtk-3.0 ]; then + mkdir -p $HOME/.config/gtk-3.0 cat >$HOME/.config/gtk-3.0/settings.ini <&2 # Make sure that D-Bus is running -if qdbus >/dev/null 2>/dev/null; then +if @qdbus@ >/dev/null 2>/dev/null; then : # ok else echo 'startkde: Could not start D-Bus. Can you call qdbus?' 1>&2 test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null - xmessage -geometry 500x100 "Could not start D-Bus. Can you call qdbus?" + @xmessage@ -geometry 500x100 "Could not start D-Bus. Can you call qdbus?" exit 1 fi @@ -272,11 +269,11 @@ fi # KDE_FULL_SESSION=true export KDE_FULL_SESSION -xprop -root -f KDE_FULL_SESSION 8t -set KDE_FULL_SESSION true +@xprop@ -root -f KDE_FULL_SESSION 8t -set KDE_FULL_SESSION true KDE_SESSION_VERSION=5 export KDE_SESSION_VERSION -xprop -root -f KDE_SESSION_VERSION 32c -set KDE_SESSION_VERSION 5 +@xprop@ -root -f KDE_SESSION_VERSION 32c -set KDE_SESSION_VERSION 5 KDE_SESSION_UID=$(id -ru) export KDE_SESSION_UID @@ -298,7 +295,7 @@ export XDG_CURRENT_DESKTOP # For anything else (that doesn't set env vars, or that needs a window manager), # better use the Autostart folder. -IFS=":" read -r -a scriptpath <<< $(qtpaths --paths GenericConfigLocation) +IFS=":" read -r -a scriptpath <<< $(@qtpaths@ --paths GenericConfigLocation) # Add /env/ to the directory to locate the scripts to be sourced for prefix in "${scriptpath[@]}"; do for file in "$prefix"/plasma-workspace/env/*.sh; do @@ -306,37 +303,28 @@ for prefix in "${scriptpath[@]}"; do done done -# At this point all the environment is ready, let's send it to kwalletd if running -if test -n "$PAM_KWALLET_LOGIN" ; then - env | socat STDIN UNIX-CONNECT:$PAM_KWALLET_LOGIN -fi -# ...and also to kwalletd5 -if test -n "$PAM_KWALLET5_LOGIN" ; then - env | socat STDIN UNIX-CONNECT:$PAM_KWALLET5_LOGIN -fi - # At this point all environment variables are set, let's send it to the DBus session server to update the activation environment -dbus-update-activation-environment --systemd --all +@dbus_update_activation_environment@ --systemd --all if test $? -ne 0; then # Startup error echo 'startkde: Could not sync environment to dbus.' 1>&2 test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null - xmessage -geometry 500x100 "Could not sync environment to dbus." + @xmessage@ -geometry 500x100 "Could not sync environment to dbus." exit 1 fi # We set LD_BIND_NOW to increase the efficiency of kdeinit. # kdeinit unsets this variable before loading applications. -LD_BIND_NOW=true start_kdeinit_wrapper --kded +kcminit_startup +LD_BIND_NOW=true @start_kdeinit_wrapper@ --kded +kcminit_startup if test $? -ne 0; then # Startup error echo 'startkde: Could not start kdeinit5. Check your installation.' 1>&2 test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null - xmessage -geometry 500x100 "Could not start kdeinit5. Check your installation." + @xmessage@ -geometry 500x100 "Could not start kdeinit5. Check your installation." exit 1 fi -qdbus org.kde.KSplash /KSplash org.kde.KSplash.setStage kinit +@qdbus@ org.kde.KSplash /KSplash org.kde.KSplash.setStage kinit # finally, give the session control to the session manager # see kdebase/ksmserver for the description of the rest of the startup sequence @@ -353,15 +341,15 @@ test -n "$KDEWM" && KDEWM="--windowmanager $KDEWM" # lock now and do the rest of the KDE startup underneath the locker. KSMSERVEROPTIONS="" test -n "$dl" && KSMSERVEROPTIONS=" --lockscreen" -kwrapper5 ksmserver $KDEWM $KSMSERVEROPTIONS +@kwrapper5@ @ksmserver@ $KDEWM $KSMSERVEROPTIONS if test $? -eq 255; then # Startup error echo 'startkde: Could not start ksmserver. Check your installation.' 1>&2 test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null - xmessage -geometry 500x100 "Could not start ksmserver. Check your installation." + @xmessage@ -geometry 500x100 "Could not start ksmserver. Check your installation." fi -wait_drkonqi=$(kreadconfig5 --file startkderc --group WaitForDrKonqi --key Enabled --default true) +wait_drkonqi=$(@kreadconfig5@ --file startkderc --group WaitForDrKonqi --key Enabled --default true) if test x"$wait_drkonqi"x = x"true"x ; then # wait for remaining drkonqi instances with timeout (in seconds) @@ -372,8 +360,8 @@ if test x"$wait_drkonqi"x = x"true"x ; then wait_drkonqi_counter=$((wait_drkonqi_counter+5)) if test "$wait_drkonqi_counter" -ge "$wait_drkonqi_timeout" ; then # ask remaining drkonqis to die in a graceful way - qdbus | grep 'org.kde.drkonqi-' | while read address ; do - qdbus "$address" "/MainApplication" "quit" + @qdbus@ | grep 'org.kde.drkonqi-' | while read address ; do + @qdbus@ "$address" "/MainApplication" "quit" done break fi @@ -385,12 +373,12 @@ echo 'startkde: Shutting down...' 1>&2 test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null # Clean up -kdeinit5_shutdown +@kdeinit5_shutdown@ unset KDE_FULL_SESSION -xprop -root -remove KDE_FULL_SESSION +@xprop@ -root -remove KDE_FULL_SESSION unset KDE_SESSION_VERSION -xprop -root -remove KDE_SESSION_VERSION +@xprop@ -root -remove KDE_SESSION_VERSION unset KDE_SESSION_UID echo 'startkde: Done.' 1>&2 -- cgit 1.4.1