Skip to content

Instantly share code, notes, and snippets.

@Mic92
Last active July 2, 2020 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mic92/8f095a2836f037639d7fd53b8ac3efe2 to your computer and use it in GitHub Desktop.
Save Mic92/8f095a2836f037639d7fd53b8ac3efe2 to your computer and use it in GitHub Desktop.
stdenv with -nostdinc support
with import <nixpkgs> {};
let
libcPattern =
builtins.replaceStrings ["/"] ["\\/"] "${gcc.libc_dev}/include";
gcc' = wrapCCWith {
cc = gcc.cc;
bintools = binutils;
extraBuildCommands = ''
cat >> $out/nix-support/add-flags.sh <<'EOF'
if [[ "$@" = *-nostdinc* ]]; then
NIX_CFLAGS_COMPILE_${gcc.suffixSalt}=''${NIX_CFLAGS_COMPILE_${gcc.suffixSalt}//-idirafter ${libcPattern}/}
fi
EOF
'';
};
in (overrideCC stdenv gcc').mkDerivation {
name = "env";
buildInputs = [
bashInteractive
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment