File tree Expand file tree Collapse file tree 4 files changed +25
-0
lines changed
Expand file tree Collapse file tree 4 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99### Changed
1010* ** Breaking** : dropped compatibility for Nix versions below 2.31.2
1111* ** Breaking** : dropped compatibility for nixpkgs-25.05
12+ * ` remapPathPrefixHook ` is now do nothing when building on Darwin since the
13+ current implementation results in validating build caches due to Nix behavior
14+ differences between Linux and Darwin.
1215
1316### Fixed
1417* ` mkCargoDerivation ` will now set ` noCompressDebugSectionsSet ` to disable
Original file line number Diff line number Diff line change @@ -1940,6 +1940,8 @@ a temporary location defined by `$postBuildInstallFromCargoBuildLogOut`
19401940
19411941### ` craneLib.remapSourcePathPrefixHook `
19421942
1943+ > Note: this hook is not supported when building on Darwin and will do nothing
1944+
19431945Defines ` configureRustcRemapPathPrefix() ` which can be used to set up a source
19441946map using the [ ` --remap-path-prefix ` ] option. The output of the derivation gains
19451947a dependency on the source code stored within the Nix store, but in return
Original file line number Diff line number Diff line change 11{
2+ lib ,
23 makeSetupHook ,
4+ stdenv ,
35} :
46makeSetupHook {
57 name = "remapPathPrefixHook" ;
68 substitutions = {
79 storeDir = builtins . storeDir ;
10+
11+ # Unfortunately, we cannot support automatic path remapping on Darwin. The remap paths option
12+ # requires absolute paths (since rustc will basically do a blind substitution). On Linux builds,
13+ # each derivation is chrooted to `/build/{name-of-src}` which ends up being the same string for
14+ # both the real and the deps-only derivations. On Darwin, however, this ends up being
15+ # `/nix/var/nix/builds/{name-of-derivation}` which *is* different between the main and deps-only
16+ # derivations. Since this value ends up in CARGO_BUILD_RUSTFLAGS, it effectively will lead to
17+ # cache invalidation when the real derivation runs if the values differ.
18+ #
19+ # Moreover, we can't "just" replace the bytes ourselves since there's no guarantee that the
20+ # original build path is the same length as the un-neutered store path. Thus we'll noop this for
21+ # now on Darwin builders and leave it up to the caller to handle path remap if needed...
22+ isDarwin = lib . optionalString stdenv . buildPlatform . isDarwin /* bash */ ''
23+ echo 'automatic path remapping not supported on Darwin'
24+ return 0
25+ '' ;
826 } ;
927} ./remapPathPrefixHook.sh
Original file line number Diff line number Diff line change 11configureRustcRemapPathPrefix () {
2+ @isDarwin@
3+
24 local remapTo=" ${1:- ${src:? not defined} } "
35 local remapFrom=" ${2:- $(pwd)} "
46 local doNeuter=" ${3:- neuter} "
You can’t perform that action at this time.
0 commit comments