2017-03-20 17:18:47 +00:00
|
|
|
{ stdenv, lib, makeWrapper, buildEnv, gtk3, dconf }:
|
2016-07-30 21:16:36 +00:00
|
|
|
|
2017-01-02 23:33:15 +00:00
|
|
|
packages:
|
2016-07-30 21:16:36 +00:00
|
|
|
|
2016-12-21 23:47:12 +00:00
|
|
|
let
|
2017-01-02 23:33:15 +00:00
|
|
|
packages_ = if builtins.isList packages then packages else [packages];
|
|
|
|
|
|
|
|
unwrapped = lib.concatMap (p: if builtins.isList p.unwrapped then p.unwrapped else [p.unwrapped]) packages_;
|
|
|
|
targets = lib.concatMap (p: p.targets) packages_;
|
|
|
|
paths = lib.concatMap (p: p.paths or []) packages_;
|
|
|
|
|
|
|
|
name =
|
|
|
|
if builtins.length unwrapped == 1
|
|
|
|
then (lib.head unwrapped).name
|
|
|
|
else "kde-application";
|
|
|
|
meta =
|
|
|
|
if builtins.length unwrapped == 1
|
|
|
|
then (lib.head unwrapped).meta
|
|
|
|
else {};
|
|
|
|
|
2016-12-21 23:47:12 +00:00
|
|
|
env = buildEnv {
|
2017-01-02 23:33:15 +00:00
|
|
|
inherit name meta;
|
|
|
|
paths = builtins.map lib.getBin (unwrapped ++ paths);
|
2016-12-21 23:47:12 +00:00
|
|
|
pathsToLink = [ "/bin" "/share" "/lib/qt5" "/etc/xdg" ];
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
2016-07-30 21:16:36 +00:00
|
|
|
stdenv.mkDerivation {
|
2017-01-02 23:33:15 +00:00
|
|
|
inherit name meta;
|
2016-12-21 23:47:12 +00:00
|
|
|
preferLocalBuild = true;
|
2016-07-30 21:16:36 +00:00
|
|
|
|
2017-01-02 23:33:15 +00:00
|
|
|
inherit unwrapped env targets;
|
2016-07-30 21:16:36 +00:00
|
|
|
|
2017-01-02 23:33:15 +00:00
|
|
|
passthru = {
|
|
|
|
inherit targets paths;
|
|
|
|
unwrapped = if builtins.length unwrapped == 1 then lib.head unwrapped else unwrapped;
|
|
|
|
};
|
2016-07-30 21:16:36 +00:00
|
|
|
|
2017-01-02 23:33:15 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2016-11-16 13:22:06 +00:00
|
|
|
|
2017-01-02 23:33:15 +00:00
|
|
|
buildCommand = ''
|
2016-07-30 21:16:36 +00:00
|
|
|
for t in $targets; do
|
2017-01-02 23:33:15 +00:00
|
|
|
good=""
|
|
|
|
for drv in $unwrapped; do
|
|
|
|
if [ -a "$drv/$t" ]; then
|
|
|
|
makeWrapper "$drv/$t" "$out/$t" \
|
|
|
|
--argv0 '"$0"' \
|
|
|
|
--suffix PATH : "$env/bin" \
|
2017-01-16 03:46:07 +00:00
|
|
|
--prefix XDG_CONFIG_DIRS : "$env/etc/xdg" \
|
2017-03-20 17:18:47 +00:00
|
|
|
--prefix XDG_DATA_DIRS : "$env/share:${gtk3}/share/gsettings-schemas/${gtk3.name}" \
|
2017-04-23 13:55:01 +00:00
|
|
|
--prefix QML_IMPORT_PATH : "$env/lib/qt5/imports" \
|
|
|
|
--prefix QML2_IMPORT_PATH : "$env/lib/qt5/qml" \
|
|
|
|
--prefix QT_PLUGIN_PATH : "$env/lib/qt5/plugins" \
|
2017-03-20 17:18:47 +00:00
|
|
|
--prefix GIO_EXTRA_MODULES : "${dconf.lib}/lib/gio/modules"
|
2017-01-02 23:33:15 +00:00
|
|
|
good="1"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -z "$good" ]; then
|
|
|
|
echo "file or directory not found in derivations: $t"
|
2016-07-30 21:16:36 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2017-01-09 22:06:37 +00:00
|
|
|
mkdir -p "$out/nix-support"
|
2017-01-10 16:05:51 +00:00
|
|
|
echo "$unwrapped" > "$out/nix-support/propagated-user-env-packages"
|
2016-07-30 21:16:36 +00:00
|
|
|
'';
|
|
|
|
}
|