trivial-builders: add rmDbusServicesInPlace for when the symlink method isnt applicable

This commit is contained in:
Colin 2024-02-19 13:43:22 +00:00
parent 44647e0d36
commit a3d0691d99
2 changed files with 13 additions and 2 deletions

View File

@ -1,4 +1,5 @@
{ runCommand
, rmDbusServicesInPlace
, symlinkJoin
}:
{
@ -27,10 +28,19 @@
# 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: symlinkJoin {
rmDbusServices = pkg: rmDbusServicesInPlace (symlinkJoin {
name = pkg.name or pkg.pname;
paths = [ pkg ];
postBuild = ''
runHook postFixup
'';
});
# 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
# check the output to see it's what you want.
rmDbusServicesInPlace = pkg: pkg.overrideAttrs (base: {
postFixup = (base.postFixup or "") + ''
rm -rf $out/share/dbus-1
for d in $out/share/applications/*.desktop; do
if substitute "$d" ./substituteResult --replace-fail DBusActivatable=true DBusActivatable=false; then
@ -38,5 +48,5 @@
fi
done
'';
};
});
}

View File

@ -69,6 +69,7 @@ let
copyIntoOwnPackage
linkIntoOwnPackage
rmDbusServices
rmDbusServicesInPlace
;
unftp = callPackage ./additional/unftp { };
where-am-i = callPackage ./additional/where-am-i { };