From 2a851809aad99af61aabaa8b25d8b0db3d576478 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Tue, 17 Feb 2026 19:32:56 +0000 Subject: [PATCH] treefmt.withConfig: define pname & propagate all files using symlinkJoin --- pkgs/by-name/tr/treefmt/modules/wrapper.nix | 41 ++++++++++----------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/pkgs/by-name/tr/treefmt/modules/wrapper.nix b/pkgs/by-name/tr/treefmt/modules/wrapper.nix index bb5c47c76f60..d736db5b5d77 100644 --- a/pkgs/by-name/tr/treefmt/modules/wrapper.nix +++ b/pkgs/by-name/tr/treefmt/modules/wrapper.nix @@ -15,26 +15,23 @@ internal = true; }; - config.result = - pkgs.runCommand config.name - { - nativeBuildInputs = [ pkgs.makeBinaryWrapper ]; - env = { - inherit (config) configFile; - binPath = lib.makeBinPath config.runtimeInputs; - }; - passthru = { - inherit (config) runtimeInputs; - inherit config options; - }; - inherit (config.package) meta version; - } - '' - mkdir -p $out/bin - makeWrapper \ - ${lib.getExe config.package} \ - $out/bin/treefmt \ - --prefix PATH : "$binPath" \ - --add-flags "--config-file $configFile" - ''; + config.result = pkgs.symlinkJoin { + pname = config.name; + inherit (config.package) meta version; + nativeBuildInputs = [ pkgs.makeBinaryWrapper ]; + paths = [ config.package ]; + env = { + inherit (config) configFile; + binPath = lib.makeBinPath config.runtimeInputs; + }; + passthru = { + inherit (config) runtimeInputs; + inherit config options; + }; + postBuild = '' + wrapProgram "$out/bin/treefmt" \ + --prefix PATH : "$binPath" \ + --add-flags "--config-file $configFile" + ''; + }; }