trivial-builders: init deepLinkIntoOwnPackage

This commit is contained in:
Colin 2024-05-31 23:25:26 +00:00
parent f296d8df93
commit a380bd04c4
2 changed files with 15 additions and 9 deletions

View File

@ -1,4 +1,5 @@
{ lib
, deepLinkIntoOwnPackage
, rmDbusServicesInPlace
, runCommandLocalOverridable
, stdenv
@ -15,6 +16,8 @@
"runHook preBuild"
buildPhase
"runHook postBuild"
"runHook postInstall"
"runHook postFixup"
];
};
# given some package and a path, extract the item at `${package}/${path}` into
@ -30,7 +33,6 @@
mkdir -p "$out/$(dirname $item)"
cp -a "${pkg}/$item" "$out/$item"
done
runHook postFixup
'';
linkIntoOwnPackage = pkg: path: let
@ -42,20 +44,23 @@
mkdir -p "$out/$(dirname $item)"
ln -s "${pkg}/$item" "$out/$item"
done
'';
deepLinkIntoOwnPackage = pkg: symlinkJoin {
name = pkg.pname or pkg.name;
paths = [ pkg ];
meta = pkg.meta or {};
postBuild = ''
runHook postBuild
runHook postInstall
runHook postFixup
'';
};
# given some package, create a new package which symlinks every file of the original
# *except* for its dbus files.
# in addition, edit its .desktop files to clarify that it can't be "dbus activated".
rmDbusServices = pkg: rmDbusServicesInPlace (symlinkJoin {
name = pkg.name or pkg.pname;
paths = [ pkg ];
postBuild = ''
runHook postFixup
'';
meta = pkg.meta or {};
});
rmDbusServices = pkg: rmDbusServicesInPlace (deepLinkIntoOwnPackage pkg);
# like rmDbusServices, but do it by patching the derivation instead of wrapping it.
# unlike `rmDbusServices`, this won't work on *all* derivation types (e.g. runCommand), so you should

View File

@ -90,6 +90,7 @@ let
wvkbd-mk = callPackage ./additional/wvkbd-mk { };
inherit (trivial-builders)
copyIntoOwnPackage
deepLinkIntoOwnPackage
linkIntoOwnPackage
rmDbusServices
rmDbusServicesInPlace