From a40a9dcfcce250fc0275a09f7482dcddcc89080c Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 22 Jul 2025 22:29:16 +0000 Subject: [PATCH] linkIntoOwnPackage: make `pathsToLink` introspectable/injectable by consumers --- pkgs/by-name/trivial-builders/package.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/trivial-builders/package.nix b/pkgs/by-name/trivial-builders/package.nix index fdae785b9..d26b4f8f6 100644 --- a/pkgs/by-name/trivial-builders/package.nix +++ b/pkgs/by-name/trivial-builders/package.nix @@ -48,13 +48,20 @@ in runCommandLocalOverridable "${pkg.pname or pkg.name}-${suffix}" ({ outputs = [ "out" ] ++ lib.optionals wantMan' [ "man" ]; + pathsToLink = paths; + configurePhase = '' + runHook preConfigure + # all vars supplied by nix are str, so convert -> array + concatTo pathsToLink pathsToLink + runHook postConfigure + ''; } // args) '' tryLink() { local srcPath="$1/$2" local dirName=$(dirname "$2") test -e "$srcPath" && mkdir -p "$out/$dirName" && ln -s "$srcPath" "$out/$2" } - for item in ${lib.escapeShellArgs paths}; do + for item in "''${pathsToLink[@]}"; do tryLink "${bin}" "$item" || tryLink "${man}" "$item" || tryLink "${out}" "$item" ||