kdeWrapper: reduce closure size

This commit is contained in:
Thomas Tuegel 2016-11-16 07:22:06 -06:00
parent ecbb4db055
commit 58811df272
No known key found for this signature in database
GPG Key ID: 22CBF5249D4B4D59
2 changed files with 29 additions and 13 deletions

View File

@ -63,7 +63,6 @@ let
kdeWrapper = import ./kde-wrapper.nix {
inherit (pkgs) stdenv lib makeWrapper;
inherit kdeEnv;
};
attica = callPackage ./attica.nix {};

View File

@ -1,17 +1,14 @@
{ stdenv, lib, makeWrapper, kdeEnv }:
{ stdenv, lib, makeWrapper }:
drv:
{ targets, paths ? [] }:
let
env = kdeEnv drv paths;
in
stdenv.mkDerivation {
inherit (drv) name;
drv = lib.getBin drv;
inherit env targets;
paths = builtins.map lib.getBin ([drv] ++ paths);
inherit drv targets;
passthru = { unwrapped = drv; };
nativeBuildInputs = [ makeWrapper ];
@ -21,16 +18,36 @@ stdenv.mkDerivation {
buildPhase = "true";
installPhase = ''
propagated=
for p in $drv $paths; do
findInputs $p propagated propagated-user-env-packages
done
wrap_PATH="$out/bin"
wrap_XDG_DATA_DIRS=
wrap_XDG_CONFIG_DIRS=
wrap_QML_IMPORT_PATH=
wrap_QML2_IMPORT_PATH=
wrap_QT_PLUGIN_PATH=
for p in $propagated; do
addToSearchPath wrap_PATH "$p/bin"
addToSearchPath wrap_XDG_DATA_DIRS "$p/share"
addToSearchPath wrap_XDG_CONFIG_DIRS "$p/etc/xdg"
addToSearchPath wrap_QML_IMPORT_PATH "$p/lib/qt5/imports"
addToSearchPath wrap_QML2_IMPORT_PATH "$p/lib/qt5/qml"
addToSearchPath wrap_QT_PLUGIN_PATH "$p/lib/qt5/plugins"
done
for t in $targets; do
if [ -a "$drv/$t" ]; then
makeWrapper "$drv/$t" "$out/$t" \
--argv0 '"$0"' \
--suffix PATH : "$out/bin:$env/bin" \
--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"
--suffix PATH : "$wrap_PATH" \
--prefix XDG_CONFIG_DIRS : "$wrap_XDG_CONFIG_DIRS" \
--prefix XDG_DATA_DIRS : "$wrap_XDG_DATA_DIRS" \
--set QML_IMPORT_PATH "$wrap_QML_IMPORT_PATH" \
--set QML2_IMPORT_PATH "$wrap_QML2_IMPORT_PATH" \
--set QT_PLUGIN_PATH "$wrap_QT_PLUGIN_PATH"
else
echo "no such file or directory: $drv/$t"
exit 1