kdeWrapper: allow wrapping several packages
This commit is contained in:
parent
5ba7f33e3a
commit
e908442693
@ -60,8 +60,9 @@ let
|
||||
};
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped
|
||||
kdeWrapper
|
||||
{
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/kile" ];
|
||||
paths = [ konsole.unwrapped ];
|
||||
}
|
||||
|
@ -55,9 +55,9 @@ let
|
||||
|
||||
|
||||
in
|
||||
kdeWrapper unwrapped
|
||||
kdeWrapper
|
||||
{
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/yakuake" ];
|
||||
paths = [ konsole.unwrapped ];
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,8 @@ let
|
||||
homepage = https://konversation.kde.org;
|
||||
};
|
||||
};
|
||||
in kdeWrapper unwrapped {
|
||||
in kdeWrapper {
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/konversation" ];
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,8 @@ let
|
||||
};
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped
|
||||
kdeWrapper
|
||||
{
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/ark" ];
|
||||
}
|
||||
|
@ -24,8 +24,9 @@ let
|
||||
];
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped
|
||||
kdeWrapper
|
||||
{
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/dolphin" ];
|
||||
paths = [ dolphin-plugins konsole.unwrapped ];
|
||||
}
|
||||
|
@ -18,4 +18,7 @@ let
|
||||
];
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped { targets = [ "bin/filelight" ]; }
|
||||
kdeWrapper {
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/filelight" ];
|
||||
}
|
||||
|
@ -20,7 +20,8 @@ let
|
||||
];
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped {
|
||||
kdeWrapper {
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/gwenview" ];
|
||||
paths = [ kipi-plugins ];
|
||||
}
|
||||
|
@ -24,8 +24,9 @@ let
|
||||
];
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped
|
||||
kdeWrapper
|
||||
{
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/kate" "bin/kwrite" ];
|
||||
paths = [ konsole.unwrapped ];
|
||||
}
|
||||
|
@ -18,4 +18,7 @@ let
|
||||
];
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped { targets = [ "bin/kcalc" ]; }
|
||||
kdeWrapper {
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/kcalc" ];
|
||||
}
|
||||
|
@ -15,4 +15,7 @@ let
|
||||
propagatedBuildInputs = [ ki18n kwidgetsaddons kxmlgui ];
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped { targets = [ "bin/kcolorchooser" ]; }
|
||||
kdeWrapper {
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/kcolorchooser" ];
|
||||
}
|
||||
|
@ -74,8 +74,9 @@ unwrapped = kdeApp {
|
||||
};
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped
|
||||
kdeWrapper
|
||||
{
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/kdenlive" ];
|
||||
paths = [ kinit ];
|
||||
}
|
||||
|
@ -18,4 +18,7 @@ let
|
||||
];
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped { targets = [ "bin/kdf" ]; }
|
||||
kdeWrapper {
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/kdf" ];
|
||||
}
|
||||
|
@ -16,4 +16,7 @@ let
|
||||
];
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped { targets = [ "bin/khelpcenter" ]; }
|
||||
kdeWrapper {
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/khelpcenter" ];
|
||||
}
|
||||
|
@ -15,4 +15,7 @@ let
|
||||
];
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped { targets = [ "bin/kompare" ]; }
|
||||
kdeWrapper {
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/kompare" ];
|
||||
}
|
||||
|
@ -24,4 +24,7 @@ let
|
||||
];
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped { targets = [ "bin/konsole" ]; }
|
||||
kdeWrapper {
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/konsole" ];
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ let
|
||||
kxmlgui
|
||||
];
|
||||
};
|
||||
in kdeWrapper unwrapped {
|
||||
in kdeWrapper {
|
||||
inherit unwrapped;
|
||||
targets = ["bin/kwalletmanager5"];
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ let
|
||||
enableParallelBuilding = true;
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped {
|
||||
kdeWrapper {
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/marble-qt" ];
|
||||
paths = [ unwrapped ];
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ let
|
||||
};
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped {
|
||||
kdeWrapper {
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/okular" ];
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ let
|
||||
];
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped {
|
||||
kdeWrapper {
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/spectacle" ];
|
||||
paths = [ kipi-plugins ];
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ let
|
||||
];
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped {
|
||||
kdeWrapper {
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/oxygen-demo5" "bin/oxygen-settings5" ];
|
||||
}
|
||||
|
@ -1,53 +1,73 @@
|
||||
{ stdenv, lib, makeWrapper, buildEnv }:
|
||||
|
||||
drv:
|
||||
|
||||
{ targets, paths ? [] }:
|
||||
packages:
|
||||
|
||||
let
|
||||
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 {};
|
||||
|
||||
env = buildEnv {
|
||||
inherit (drv) name meta;
|
||||
paths = builtins.map lib.getBin ([drv] ++ paths);
|
||||
inherit name meta;
|
||||
paths = builtins.map lib.getBin (unwrapped ++ paths);
|
||||
pathsToLink = [ "/bin" "/share" "/lib/qt5" "/etc/xdg" ];
|
||||
};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
inherit (drv) name meta;
|
||||
inherit name meta;
|
||||
preferLocalBuild = true;
|
||||
|
||||
paths = builtins.map lib.getBin ([drv] ++ paths);
|
||||
inherit drv env targets;
|
||||
passthru = { unwrapped = drv; };
|
||||
inherit unwrapped env targets;
|
||||
|
||||
passthru = {
|
||||
inherit targets paths;
|
||||
unwrapped = if builtins.length unwrapped == 1 then lib.head unwrapped else unwrapped;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
builder = builtins.toFile "builder.sh" ''
|
||||
. $stdenv/setup
|
||||
|
||||
buildCommand = ''
|
||||
for t in $targets; do
|
||||
if [ -a "$drv/$t" ]; then
|
||||
makeWrapper "$drv/$t" "$out/$t" \
|
||||
--argv0 '"$0"' \
|
||||
--suffix PATH : "$env/bin" \
|
||||
--prefix XDG_CONFIG_DIRS : "$env/share" \
|
||||
--prefix XDG_DATA_DIRS : "$env/etc/xdg" \
|
||||
--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"
|
||||
good=""
|
||||
for drv in $unwrapped; do
|
||||
if [ -a "$drv/$t" ]; then
|
||||
makeWrapper "$drv/$t" "$out/$t" \
|
||||
--argv0 '"$0"' \
|
||||
--suffix PATH : "$env/bin" \
|
||||
--prefix XDG_CONFIG_DIRS : "$env/share" \
|
||||
--prefix XDG_DATA_DIRS : "$env/etc/xdg" \
|
||||
--set QML_IMPORT_PATH "$env/lib/qt5/imports" \
|
||||
--set QML2_IMPORT_PATH "$env/lib/qt5/qml" \
|
||||
--set QT_PLUGIN_PATH "$env/lib/qt5/plugins"
|
||||
good="1"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$good" ]; then
|
||||
echo "file or directory not found in derivations: $t"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -a "$drv/share" ]; then
|
||||
ln -s "$drv/share" "$out"
|
||||
fi
|
||||
ln -s "$env/share" "$out"
|
||||
|
||||
if [ -a "$drv/nix-support/propagated-user-env-packages" ]; then
|
||||
mkdir -p "$out/nix-support"
|
||||
ln -s "$drv/nix-support/propagated-user-env-packages" "$out/nix-support/"
|
||||
fi
|
||||
for drv in $unwrapped; do
|
||||
if [ -a "$drv/nix-support/propagated-user-env-packages" ]; then
|
||||
mkdir -p "$out/nix-support"
|
||||
cat "$drv/nix-support/propagated-user-env-packages" >> "$out/nix-support/propagated-user-env-packages"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ let
|
||||
propagatedBuildInputs = [ kconfig kinit ];
|
||||
};
|
||||
in
|
||||
kdeWrapper unwrapped {
|
||||
kdeWrapper {
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/kronometer" ];
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ let
|
||||
|
||||
};
|
||||
|
||||
in kdeWrapper unwrapped {
|
||||
in kdeWrapper {
|
||||
inherit unwrapped;
|
||||
targets = [ "bin/peruse" ];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user