|
16 | 16 | url = "github:ipetkov/crane"; |
17 | 17 | }; |
18 | 18 | nix2container = { |
19 | | - # TODO(SchahinRohani): Use a specific commit hash until nix2container is stable. |
20 | | - url = "github:nlewo/nix2container/cc96df7c3747c61c584d757cfc083922b4f4b33e"; |
| 19 | + url = "github:nlewo/nix2container"; |
21 | 20 | inputs.nixpkgs.follows = "nixpkgs"; |
22 | 21 | }; |
23 | 22 | }; |
|
101 | 100 | # Map the nix system to the Rust target triple that we'd want to target |
102 | 101 | # by default. |
103 | 102 | targetArch = |
104 | | - ( |
105 | | - nixSystem: |
106 | | - { |
107 | | - "x86_64-linux" = "x86_64-unknown-linux-musl"; |
108 | | - "aarch64-linux" = "aarch64-unknown-linux-musl"; |
109 | | - "x86_64-darwin" = "x86_64-apple-darwin"; |
110 | | - "aarch64-darwin" = "aarch64-apple-darwin"; |
111 | | - }.${ |
112 | | - nixSystem |
113 | | - } or (throw "Unsupported Nix host platform: ${nixSystem}") |
114 | | - ) |
115 | | - p.stdenv.targetPlatform.system; |
| 103 | + if p.stdenv.targetPlatform.isLinux |
| 104 | + then |
| 105 | + if p.stdenv.targetPlatform.isMusl |
| 106 | + then |
| 107 | + if p.stdenv.targetPlatform.isAarch64 |
| 108 | + then "aarch64-unknown-linux-musl" |
| 109 | + else "x86_64-unknown-linux-musl" |
| 110 | + else if p.stdenv.targetPlatform.isAarch64 |
| 111 | + then "aarch64-unknown-linux-gnu" |
| 112 | + else "x86_64-unknown-linux-gnu" |
| 113 | + else |
| 114 | + ( |
| 115 | + nixSystem: |
| 116 | + { |
| 117 | + "x86_64-darwin" = "x86_64-apple-darwin"; |
| 118 | + "aarch64-darwin" = "aarch64-apple-darwin"; |
| 119 | + }.${ |
| 120 | + nixSystem |
| 121 | + } or (throw "Unsupported Nix host platform: ${nixSystem}") |
| 122 | + ) |
| 123 | + p.stdenv.targetPlatform.system; |
116 | 124 |
|
117 | 125 | # Full path to the linker for CARGO_TARGET_XXX_LINKER |
118 | 126 | linkerPath = |
|
125 | 133 | { |
126 | 134 | inherit src; |
127 | 135 | stdenv = q: |
128 | | - if q.stdenv.targetPlatform.isLinux |
| 136 | + if q.stdenv.targetPlatform.isLinux && !q.stdenv.hostPlatform.isMusl |
129 | 137 | then q.pkgsMusl.stdenv |
130 | 138 | else q.stdenv; |
131 | 139 | strictDeps = true; |
|
168 | 176 | then pkgs.pkgsCross.musl64 |
169 | 177 | else if pkgs.system == "aarch64-linux" |
170 | 178 | then pkgs.pkgsCross.aarch64-multiplatform-musl |
| 179 | + else if pkgs.system == "x86_64-darwin" |
| 180 | + then pkgs.pkgsCross.gnu64 |
| 181 | + else if pkgs.system == "aarch64-darwin" |
| 182 | + then pkgs.pkgsCross.aarch64-multiplatform |
171 | 183 | else pkgs; |
172 | 184 |
|
173 | 185 | nativelink = nativelinkFor nativeTargetPkgs; |
174 | 186 |
|
175 | 187 | # These two can be built by all build platforms. This is not true for |
176 | 188 | # darwin targets which are only buildable via native compilation. |
177 | | - nativelink-aarch64-linux = nativelinkFor pkgs.pkgsCross.aarch64-multiplatform-musl; |
178 | | - nativelink-x86_64-linux = nativelinkFor pkgs.pkgsCross.musl64; |
| 189 | + nativelink-aarch64-linux = nativelinkFor pkgs.pkgsCross.aarch64-multiplatform; |
| 190 | + nativelink-x86_64-linux = nativelinkFor pkgs.pkgsCross.gnu64; |
179 | 191 |
|
180 | 192 | nativelink-is-executable-test = pkgs.callPackage ./tools/nativelink-is-executable-test.nix {inherit nativelink;}; |
181 | 193 |
|
|
331 | 343 | (_final: prev: { |
332 | 344 | cargo-llvm-cov = prev.cargo-llvm-cov.overrideAttrs (old: { |
333 | 345 | meta = old.meta // {broken = false;}; |
| 346 | + doCheck = false; |
334 | 347 | }); |
335 | 348 | }) |
336 | 349 | ]; |
|
374 | 387 |
|
375 | 388 | generate-bazel-rc = pkgs.callPackage tools/generate-bazel-rc/build.nix {craneLib = craneLibFor pkgs;}; |
376 | 389 | generate-stores-config = pkgs.callPackage nativelink-config/generate-stores-config/build.nix {craneLib = craneLibFor pkgs;}; |
| 390 | + |
| 391 | + inherit |
| 392 | + nativelink-aarch64-linux |
| 393 | + nativelink-image |
| 394 | + nativelink-worker-init |
| 395 | + nativelink-x86_64-linux |
| 396 | + ; |
| 397 | + image = nativelink-image; |
377 | 398 | } |
378 | 399 | // (pkgs.lib.optionalAttrs pkgs.stdenv.isLinux rec { |
379 | 400 | inherit |
|
382 | 403 | nativelink-worker-init |
383 | 404 | nativelink-x86_64-linux |
384 | 405 | ; |
| 406 | + image = nativelink-image; |
385 | 407 |
|
386 | 408 | nativelink-worker-lre-cc = createWorker pkgs.lre.lre-cc.image; |
387 | 409 | lre-java = pkgs.callPackage ./local-remote-execution/lre-java.nix {inherit buildImage;}; |
|
392 | 414 | nativelink-worker-toolchain-drake = createWorker toolchain-drake; |
393 | 415 | nativelink-worker-toolchain-buck2 = createWorker toolchain-buck2; |
394 | 416 | nativelink-worker-buck2-toolchain = buck2-toolchain; |
395 | | - image = nativelink-image; |
396 | 417 | }) |
397 | 418 | // ( |
398 | 419 | # It's not possible to crosscompile to darwin, not even between |
|
0 commit comments