nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 42 lines 830 B view raw
1{ 2 lib, 3 runCommand, 4 zig, 5 stdenv, 6 makeWrapper, 7}: 8let 9 targetPrefix = lib.optionalString ( 10 stdenv.hostPlatform != stdenv.targetPlatform 11 ) "${stdenv.targetPlatform.config}-"; 12in 13runCommand "zig-cc-${zig.version}" 14 { 15 pname = "zig-cc"; 16 inherit (zig) version; 17 18 nativeBuildInputs = [ makeWrapper ]; 19 20 passthru = { 21 isZig = true; 22 inherit targetPrefix; 23 }; 24 25 inherit zig; 26 27 meta = zig.meta // { 28 mainProgram = "${targetPrefix}clang"; 29 }; 30 } 31 '' 32 mkdir -p $out/bin 33 for tool in cc c++ ld.lld; do 34 makeWrapper "$zig/bin/zig" "$out/bin/$tool" \ 35 --add-flags "$tool" \ 36 --run "export ZIG_GLOBAL_CACHE_DIR=\$TMPDIR/zig-cache" 37 done 38 39 ln -s $out/bin/c++ $out/bin/clang++ 40 ln -s $out/bin/cc $out/bin/clang 41 ln -s $out/bin/ld.lld $out/bin/ld 42 ''