2013-05-09 20:40:29 +02:00
|
|
|
{ stdenv, kde4, shared_mime_info, extraLibs ? [] }:
|
|
|
|
|
|
|
|
/* Supply a KDE program, and it will have the necessary KDE vars to
|
|
|
|
get icons, mime types, etc. working.
|
|
|
|
For example:
|
|
|
|
|
|
|
|
packageOverrides = pkgs : {
|
|
|
|
kdenliveWrapped = kde4.wrapper kde4.kdenlive;
|
|
|
|
};
|
|
|
|
*/
|
|
|
|
program:
|
|
|
|
|
|
|
|
let
|
2013-05-09 20:44:27 +02:00
|
|
|
libs = with kde4; [ kdelibs kde_runtime oxygen_icons shared_mime_info ]
|
|
|
|
++ extraLibs;
|
2013-05-09 20:40:29 +02:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = program.name + "-wrapped";
|
|
|
|
|
|
|
|
inherit libs;
|
|
|
|
|
|
|
|
buildCommand = ''
|
2014-06-30 14:56:10 +02:00
|
|
|
mkdir -p $out/bin
|
2013-05-09 20:40:29 +02:00
|
|
|
|
2013-05-12 16:11:54 +02:00
|
|
|
KDEDIRS=${program}
|
|
|
|
QT_PLUGIN_PATH=${program}/lib/qt4/plugins:${program}/lib/kde4/plugins
|
2013-05-09 20:40:29 +02:00
|
|
|
for a in $libs; do
|
|
|
|
KDEDIRS=$a''${KDEDIRS:+:}$KDEDIRS
|
2013-05-09 20:44:27 +02:00
|
|
|
QT_PLUGIN_PATH=$a/lib/qt4/plugins:$a/lib/kde4/plugins''${QT_PLUGIN_PATH:+:}$QT_PLUGIN_PATH
|
2013-05-09 20:40:29 +02:00
|
|
|
done
|
|
|
|
for a in ${program}/bin/*; do
|
|
|
|
PROG=$out/bin/`basename $a`
|
|
|
|
cat > $PROG << END
|
2013-05-12 16:11:54 +02:00
|
|
|
#!/bin/sh
|
|
|
|
export KDEDIRS=$KDEDIRS\''${KDEDIRS:+:}\$KDEDIRS
|
|
|
|
export QT_PLUGIN_PATH=$QT_PLUGIN_PATH\''${QT_PLUGIN_PATH:+:}\$QT_PLUGIN_PATH
|
|
|
|
exec $a "\$@"
|
2013-05-09 20:40:29 +02:00
|
|
|
END
|
|
|
|
chmod +x $PROG
|
|
|
|
done
|
|
|
|
'';
|
2014-02-10 21:03:17 +01:00
|
|
|
|
|
|
|
preferLocalBuild = true;
|
2013-05-09 20:40:29 +02:00
|
|
|
}
|