Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
38 lines
670 B
Nix
38 lines
670 B
Nix
# binfmt preserve-argv[0] wrapper
|
|
#
|
|
# More details in binfmt-p-wrapper.c
|
|
#
|
|
# The wrapper has to be static so LD_* environment variables
|
|
# cannot affect the execution of the wrapper itself.
|
|
|
|
{
|
|
lib,
|
|
stdenv,
|
|
enableDebug ? false,
|
|
}:
|
|
|
|
name: emulator:
|
|
|
|
stdenv.mkDerivation {
|
|
inherit name;
|
|
|
|
src = ./binfmt-p-wrapper.c;
|
|
|
|
dontUnpack = true;
|
|
dontInstall = true;
|
|
|
|
buildInputs = [ stdenv.cc.libc.static or null ];
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
|
|
mkdir -p $out/bin
|
|
$CC -o $out/bin/${name} -static -std=c99 -O2 \
|
|
-DTARGET_QEMU=\"${emulator}\" \
|
|
${lib.optionalString enableDebug "-DDEBUG"} \
|
|
$src
|
|
|
|
runHook postBuild
|
|
'';
|
|
}
|