diff options
author | figsoda <figsoda@pm.me> | 2023-05-29 11:47:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-29 11:47:11 -0400 |
commit | c82114ce5dffdc870b209388312495c42d02d1e0 (patch) | |
tree | d25988f068b2ae9473c1ece1eff38218d48613e7 /pkgs/build-support | |
parent | f89d84ae5ecfaa12b1b6b76966c9b391ee0b4220 (diff) | |
parent | 4b94ae4bc62e7fb2b05da58ca997fd6c3c218a85 (diff) |
Merge pull request #234454 from figsoda/bin
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/trivial-builders/default.nix | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/pkgs/build-support/trivial-builders/default.nix b/pkgs/build-support/trivial-builders/default.nix index 255a873e4cc59..d3cb22a1f5351 100644 --- a/pkgs/build-support/trivial-builders/default.nix +++ b/pkgs/build-support/trivial-builders/default.nix @@ -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} @@ -230,7 +236,7 @@ rec { */ - writeScriptBin = name: text: writeTextFile {inherit name text; executable = true; destination = "/bin/${name}"; meta.mainProgram = name;}; + writeScriptBin = name: text: writeTextFile {inherit name text; executable = true; destination = "/bin/${name}";}; /* Similar to writeScript. Writes a Shell script and checks its syntax. @@ -288,7 +294,6 @@ rec { checkPhase = '' ${stdenv.shellDryRun} "$target" ''; - meta.mainProgram = name; }; /* @@ -351,8 +356,6 @@ rec { runHook postCheck '' else checkPhase; - - meta.mainProgram = name; }; # Create a C binary |