Using Clang instead of GCC: Difference between revisions

imported>Mickours
Adding more details + different scenario
imported>Symphorien
add an example of nix-shell with clang
Line 78: Line 78:
nix-build ./hello_with_clan.nix
nix-build ./hello_with_clan.nix
</syntaxhighlight>
</syntaxhighlight>
== With nix-shell ==
To use clang in nix-shell instead of gcc:
<syntaxhighlight lang="nix">
# in file ./shell.nix
with import <nixpkgs> {};
clangStdenv.mkDerivation {
  name = "clang-nix-shell";
  buildInputs = [ /* add libraries here */ ];
}
</syntaxhighlight>


[[Category:Nixpkgs]]
[[Category:Nixpkgs]]