Merge pull request #224917 from uri-canva/uri/fix-symlinks

buildBazelPackage: fix difference between linux and darwin deps

authored by

Uri Baghin and committed by
GitHub
0a657473 936c0f65

+30 -3
+27
pkgs/build-support/build-bazel-package/default.nix
··· 1 1 { stdenv 2 2 , cacert 3 3 , lib 4 + , writeCBin 4 5 }: 5 6 6 7 args@{ ··· 75 76 ${lib.strings.concatStringsSep " " additionalFlags} \ 76 77 ${lib.strings.concatStringsSep " " targets} 77 78 ''; 79 + # we need this to chmod dangling symlinks on darwin, gnu coreutils refuses to do so: 80 + # chmod: cannot operate on dangling symlink '$symlink' 81 + chmodder = writeCBin "chmodder" '' 82 + #include <stdio.h> 83 + #include <stdlib.h> 84 + #include <sys/types.h> 85 + #include <sys/stat.h> 86 + #include <errno.h> 87 + #include <string.h> 88 + 89 + int main(int argc, char** argv) { 90 + mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO; 91 + if (argc != 2) { 92 + fprintf(stderr, "usage: chmodder file"); 93 + exit(EXIT_FAILURE); 94 + } 95 + if (lchmod(argv[1], mode) != 0) { 96 + fprintf(stderr, "failed to lchmod '%s': %s", argv[0], strerror(errno)); 97 + exit(EXIT_FAILURE); 98 + } 99 + } 100 + ''; 78 101 in 79 102 stdenv.mkDerivation (fBuildAttrs // { 80 103 ··· 149 172 new_target="$(readlink "$symlink" | sed "s,$NIX_BUILD_TOP,NIX_BUILD_TOP,")" 150 173 rm "$symlink" 151 174 ln -sf "$new_target" "$symlink" 175 + '' + lib.optionalString stdenv.isDarwin '' 176 + # on linux symlink permissions cannot be modified, so we modify those on darwin to match the linux ones 177 + ${chmodder}/bin/chmodder "$symlink" 178 + '' + '' 152 179 done 153 180 154 181 echo '${bazel.name}' > $bazelOut/external/.nix-bazel-version
+1 -1
pkgs/development/python-modules/jaxlib/default.nix
··· 239 239 x86_64-linux = "sha256-A0A18kxgGNGHNQ67ZPUzh3Yq2LEcRV7CqR9EfP80NQk="; 240 240 aarch64-linux = "sha256-mU2jzuDu89jVmaG/M5bA3jSd7n7lDi+h8sdhs1z8p1A="; 241 241 x86_64-darwin = "sha256-9nNTpetvjyipD/l8vKlregl1j/OnZKAcOCoZQeRBvts="; 242 - aarch64-darwin = "sha256-dOGUsdFImeOLcZ3VtgrNnd8A/HgIs/LYuH9GQV7A+78="; 242 + aarch64-darwin = "sha256-FqYwI1YC5eqSv+DYj09DC5IaBfFDUCO97y+TFhGiWAA="; 243 243 }.${stdenv.system} or (throw "unsupported system ${stdenv.system}"); 244 244 }; 245 245
+1 -1
pkgs/development/python-modules/tensorflow/default.nix
··· 398 398 else "sha256-QgOaUaq0V5HG9BOv9nEw8OTSlzINNFvbnyP8Vx+r9Xw="; 399 399 aarch64-linux = "sha256-zjnRtTG1j9cZTbP0Xnk2o/zWTNsP8T0n4Ai8IiAT3PE="; 400 400 x86_64-darwin = "sha256-RBLox9rzBKcZMm4NwnT7vQ/EjapWQJkqxuQ0LIdaM1E="; 401 - aarch64-darwin = "sha256-BRzh79lYvMHsUMk8BEYDLHTpnmeZ9+0lrDtj4XI1YY4="; 401 + aarch64-darwin = "sha256-tTk2KPFK4+0wA22xzb2C6qODgAbSxVbue0xk9JOjU04="; 402 402 }.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}"); 403 403 }; 404 404
+1 -1
pkgs/servers/http/envoy/default.nix
··· 81 81 fetchAttrs = { 82 82 sha256 = { 83 83 x86_64-linux = "sha256-H2s8sTbmKF+yRfSzLsZAT2ckFuunFwh/FMSKj+GYyPM="; 84 - aarch64-linux = "sha256-R9jzy/dpdCcGgT9yq59Wo/IN/bVo6fxnVPGhLMZ9fbM="; 84 + aarch64-linux = "sha256-1/z7sZYMiuB4Re2itDZydsFVEel2NOYmi6vRmBGVO/4="; 85 85 }.${stdenv.system} or (throw "unsupported system ${stdenv.system}"); 86 86 dontUseCmakeConfigure = true; 87 87 dontUseGnConfigure = true;