3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #20464 from ttuegel/kde-env-no-link

kdeWrapper: reduce closure size
This commit is contained in:
Thomas Tuegel 2016-11-17 06:32:19 -06:00 committed by GitHub
commit be491881f3
3 changed files with 29 additions and 49 deletions

View file

@ -56,14 +56,8 @@ let
} // (args.meta or {});
});
kdeEnv = import ./kde-env.nix {
inherit (pkgs) stdenv lib;
inherit (pkgs.xorg) lndir;
};
kdeWrapper = import ./kde-wrapper.nix {
inherit (pkgs) stdenv lib makeWrapper;
inherit kdeEnv;
};
attica = callPackage ./attica.nix {};

View file

@ -1,31 +0,0 @@
{ stdenv, lib, lndir }:
drv: pkgs:
stdenv.mkDerivation {
name = "kde-env-${drv.name}";
nativeBuildInputs = [ lndir ];
envPkgs = builtins.map lib.getBin ([drv] ++ pkgs);
unpackPhase = "true";
configurePhase = "runHook preConfigure; runHook postConfigure";
buildPhase = "true";
installPhase = ''
runHook preInstall
propagated=""
for i in $envPkgs; do
findInputs $i propagated propagated-user-env-packages
done
for tgt in bin etc/xdg lib/libexec lib/qt5 share; do
mkdir -p "$out/$tgt"
for p in $propagated; do
if [ -d "$p/$tgt" ]; then
lndir -silent "$p/$tgt" "$out/$tgt" >/dev/null 2>&1
fi
done
done
runHook postInstall
'';
}

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