writeCBin
pkgs.writeCBin
Docs pulled from | This Revision | 17 minutes ago
Nixpkgs manual
TODO: add to writers? pkgs/build-support/writers
Noogle detected
Implementation
The following is the current implementation of this function.
writeCBin =
pname: code:
runCommandCC pname
{
inherit pname code;
executable = true;
# Pointless to do this on a remote machine.
preferLocalBuild = true;
allowSubstitutes = false;
__structuredAttrs = true;
meta = {
mainProgram = pname;
};
}
''
n=$out/bin/${pname}
mkdir -p "$(dirname "$n")"
printf "%s" "$code" > code.c
$CC -x c code.c -o "$n"
'';