From a3d0691d99e73e6169a9793e22ee064c9d3d6df6 Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 19 Feb 2024 13:43:22 +0000 Subject: [PATCH] trivial-builders: add rmDbusServicesInPlace for when the symlink method isnt applicable --- pkgs/additional/trivial-builders/default.nix | 14 ++++++++++++-- pkgs/default.nix | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pkgs/additional/trivial-builders/default.nix b/pkgs/additional/trivial-builders/default.nix index 9cfeb608..18320adb 100644 --- a/pkgs/additional/trivial-builders/default.nix +++ b/pkgs/additional/trivial-builders/default.nix @@ -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 ''; - }; + }); } diff --git a/pkgs/default.nix b/pkgs/default.nix index 3a286416..74de1a70 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -69,6 +69,7 @@ let copyIntoOwnPackage linkIntoOwnPackage rmDbusServices + rmDbusServicesInPlace ; unftp = callPackage ./additional/unftp { }; where-am-i = callPackage ./additional/where-am-i { };