From 0b73a970af39521bd9be1465bbe28702de9c6f9c Mon Sep 17 00:00:00 2001 From: Thomas Gerbet Date: Sat, 25 Jul 2026 13:03:48 +0200 Subject: [PATCH] treefmt.withConfig: prevent an empty path segment in PATH when `config.runtimeInputs` is empty --- pkgs/by-name/tr/treefmt/modules/wrapper.nix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/tr/treefmt/modules/wrapper.nix b/pkgs/by-name/tr/treefmt/modules/wrapper.nix index b394912ce0b1..2d1a7b6d58c9 100644 --- a/pkgs/by-name/tr/treefmt/modules/wrapper.nix +++ b/pkgs/by-name/tr/treefmt/modules/wrapper.nix @@ -31,10 +31,15 @@ wrapper = finalAttrs.finalPackage; }; }; - postBuild = '' - wrapProgram "$out/bin/treefmt" \ - --prefix PATH : "$binPath" \ - --add-flags "--config-file $configFile" - ''; + postBuild = + let + wrapPrefixPathArgument = lib.optionalString ( + config.runtimeInputs != [ ] + ) "--prefix PATH : \"$binPath\""; + in + '' + wrapProgram "$out/bin/treefmt" \ + --add-flags "--config-file $configFile " ${wrapPrefixPathArgument} + ''; }); }