writers: Set mainProgram
Part of https://github.com/NixOS/nixpkgs/pull/246386
This commit is contained in:
parent
34ee0260ec
commit
0ed9e35a22
1 changed files with 17 additions and 7 deletions
|
@ -25,13 +25,21 @@ rec {
|
|||
name = last (builtins.split "/" nameOrPath);
|
||||
in
|
||||
|
||||
pkgs.runCommandLocal name (if (types.str.check content) then {
|
||||
inherit content interpreter;
|
||||
passAsFile = [ "content" ];
|
||||
} else {
|
||||
inherit interpreter;
|
||||
contentPath = content;
|
||||
}) ''
|
||||
pkgs.runCommandLocal name (
|
||||
lib.optionalAttrs (nameOrPath == "/bin/${name}") {
|
||||
meta.mainProgram = name;
|
||||
}
|
||||
// (
|
||||
if (types.str.check content) then {
|
||||
inherit content interpreter;
|
||||
passAsFile = [ "content" ];
|
||||
} else {
|
||||
inherit interpreter;
|
||||
contentPath = content;
|
||||
}
|
||||
)
|
||||
)
|
||||
''
|
||||
# On darwin a script cannot be used as an interpreter in a shebang but
|
||||
# there doesn't seem to be a limit to the size of shebang and multiple
|
||||
# arguments to the interpreter are allowed.
|
||||
|
@ -89,6 +97,8 @@ rec {
|
|||
# https://github.com/NixOS/nixpkgs/issues/154203
|
||||
# https://github.com/NixOS/nixpkgs/issues/148189
|
||||
nativeBuildInputs = [ stdenv.cc.bintools ];
|
||||
} // lib.optionalAttrs (nameOrPath == "/bin/${name}") {
|
||||
meta.mainProgram = name;
|
||||
}) ''
|
||||
${compileScript}
|
||||
${lib.optionalString strip
|
||||
|
|
Loading…
Reference in a new issue