Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv 2, targetPackages 3, lib 4, makeSetupHook 5, dieHook 6, writeShellScript 7, tests 8, cc ? targetPackages.stdenv.cc 9, sanitizers ? [] 10}: 11 12makeSetupHook { 13 name = "make-binary-wrapper-hook"; 14 propagatedBuildInputs = [ dieHook ] 15 # https://github.com/NixOS/nixpkgs/issues/148189 16 ++ lib.optional (stdenv.isDarwin && stdenv.isAarch64) cc; 17 18 substitutions = { 19 cc = "${cc}/bin/${cc.targetPrefix}cc ${lib.escapeShellArgs (map (s: "-fsanitize=${s}") sanitizers)}"; 20 }; 21 22 passthru = { 23 # Extract the function call used to create a binary wrapper from its embedded docstring 24 extractCmd = writeShellScript "extract-binary-wrapper-cmd" '' 25 strings -dw "$1" | sed -n '/^makeCWrapper/,/^$/ p' 26 ''; 27 28 tests = tests.makeBinaryWrapper; 29 }; 30} ./make-binary-wrapper.sh