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

This commit is contained in:
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 { runCommand
, rmDbusServicesInPlace
, symlinkJoin , symlinkJoin
}: }:
{ {
@@ -27,10 +28,19 @@
# given some package, create a new package which symlinks every file of the original # given some package, create a new package which symlinks every file of the original
# *except* for its dbus files. # *except* for its dbus files.
# in addition, edit its .desktop files to clarify that it can't be "dbus activated". # 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; name = pkg.name or pkg.pname;
paths = [ pkg ]; paths = [ pkg ];
postBuild = '' 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 rm -rf $out/share/dbus-1
for d in $out/share/applications/*.desktop; do for d in $out/share/applications/*.desktop; do
if substitute "$d" ./substituteResult --replace-fail DBusActivatable=true DBusActivatable=false; then if substitute "$d" ./substituteResult --replace-fail DBusActivatable=true DBusActivatable=false; then
@@ -38,5 +48,5 @@
fi fi
done done
''; '';
}; });
} }

View File

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