nixpkgs/pkgs/development/libraries/kde-frameworks/kde-wrapper.nix

44 lines
1.1 KiB
Nix
Raw Normal View History

2016-07-30 23:16:36 +02:00
{ stdenv, lib, makeWrapper, kdeEnv }:
drv:
{ targets, paths ? [] }:
2016-07-30 23:16:36 +02:00
let
2016-07-31 00:07:19 +02:00
env = kdeEnv drv paths;
2016-07-30 23:16:36 +02:00
in
stdenv.mkDerivation {
inherit (drv) name;
drv = lib.getBin drv;
inherit env targets;
passthru = { unwrapped = drv; };
nativeBuildInputs = [ makeWrapper ];
unpackPhase = "true";
configurePhase = "runHook preConfigure; runHook postConfigure";
buildPhase = "true";
installPhase = ''
for t in $targets; do
if [ -a "$drv/$t" ]; then
makeWrapper "$drv/$t" "$out/$t" \
--argv0 '"$0"' \
2016-07-31 00:07:19 +02:00
--suffix PATH : "$out/bin:$env/bin" \
2016-07-30 23:16:36 +02:00
--prefix XDG_CONFIG_DIRS : "$env/etc/xdg" \
--prefix XDG_DATA_DIRS : "$env/share" \
--set QML_IMPORT_PATH "$env/lib/qt5/imports" \
--set QML2_IMPORT_PATH "$env/lib/qt5/qml" \
--set QT_PLUGIN_PATH "$env/lib/qt5/plugins"
else
echo "no such file or directory: $drv/$t"
exit 1
fi
done
mkdir -p "$out/nix-support"
ln -s "$env/nix-support/propagated-user-env-packages" "$out/nix-support/"
2016-07-30 23:16:36 +02:00
'';
}