linkIntoOwnPackage: make pathsToLink
introspectable/injectable by consumers
This commit is contained in:
@@ -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" ||
|
||||
|
Reference in New Issue
Block a user