mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-09-19 12:08:07 +00:00
nix: use --reflink=auto instead of --link
Another Zig build system quirk worked around.
This commit is contained in:
25
build.zig.zon.nix
generated
25
build.zig.zon.nix
generated
@@ -111,11 +111,24 @@
|
||||
# puts it when the sandbox is off. Real directories make the two depths
|
||||
# agree, so it works either way.
|
||||
#
|
||||
# Only the directories have to be real. `--symbolic-link` leaves the files
|
||||
# pointing into each dependency's own store path, so the farm is a few
|
||||
# megabytes of symlinks rather than a second copy of every dependency, two
|
||||
# projects sharing a dependency share it in the store, and a file keeps the
|
||||
# mode it was fetched with.
|
||||
# The files have to be real as well, which is the expensive part and cannot
|
||||
# be avoided. `--symbolic-link` would leave them pointing into each
|
||||
# dependency's own store path, so that the farm is a few megabytes rather
|
||||
# than a second copy of every dependency -- but Zig's
|
||||
# `installHeadersDirectory` walks the directory and copies only the entries
|
||||
# whose kind is `.file`. Symlinked headers are skipped without a word, and
|
||||
# the first thing to include one fails with `'dcimgui.h' not found`.
|
||||
#
|
||||
# `--link` is not the way out. A hard link into a Nix output is a file the
|
||||
# builder did not create: inside the Linux sandbox the store is a separate
|
||||
# mount and `link` fails with `Invalid cross-device link`, while on Darwin it
|
||||
# succeeds and leaves root-owned files in the output, which Nix refuses while
|
||||
# canonicalising with `invalid ownership on file`.
|
||||
#
|
||||
# So it is a real copy, with `--reflink=auto` to share the blocks on a
|
||||
# filesystem that can. `nix store optimise` recovers the duplication after
|
||||
# the fact, hard-linking identical files across the store, which is the
|
||||
# store's own business to do and not a build's.
|
||||
copyFarm = farm: entries: pathDependencyPackages:
|
||||
runCommandLocal farm
|
||||
{
|
||||
@@ -130,7 +143,7 @@
|
||||
}
|
||||
''
|
||||
mkdir -p "$out"
|
||||
cp --recursive --link --dereference --no-preserve=mode \
|
||||
cp --recursive --reflink=auto --dereference --no-preserve=mode \
|
||||
${linkFarm farm entries}/. "$out/"
|
||||
'';
|
||||
in
|
||||
|
||||
6
flake.lock
generated
6
flake.lock
generated
@@ -108,11 +108,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788972981,
|
||||
"narHash": "sha256-MxVNwu1U7XWL/8HYzDDiaHjfIFE2yz/7J64vRUO7ZzA=",
|
||||
"lastModified": 1788977680,
|
||||
"narHash": "sha256-3vgICcen5N2oAlQrijqJhxn8HEsnXASGPxQLJVYzX0Q=",
|
||||
"owner": "jcollie",
|
||||
"repo": "zon2nix",
|
||||
"rev": "36de3f085bffe0335774392111bff0ab0e0efeba",
|
||||
"rev": "7b9c43312de08e176097b8c8920f0dd1a46982be",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
Reference in New Issue
Block a user