writeTextFile: set meta.mainProgram based on destination

(cherry picked from commit 4b94ae4bc6)
This commit is contained in:
figsoda
2023-05-27 11:09:44 -04:00
committed by github-actions[bot]
parent f3fbbc36b4
commit bf31528ed1

View File

@@ -135,9 +135,15 @@ rec {
, allowSubstitutes ? false
, preferLocalBuild ? true
}:
let
matches = builtins.match "/bin/([^/]+)" destination;
in
runCommand name
{ inherit text executable checkPhase meta allowSubstitutes preferLocalBuild;
{ inherit text executable checkPhase allowSubstitutes preferLocalBuild;
passAsFile = [ "text" ];
meta = lib.optionalAttrs (executable && matches != null) {
mainProgram = lib.head matches;
} // meta;
}
''
target=$out${lib.escapeShellArg destination}
@@ -350,8 +356,6 @@ rec {
runHook postCheck
''
else checkPhase;
meta.mainProgram = name;
};
# Create a C binary