From d17e5517c7d1b38d78811801285a38ced8c6fe5a Mon Sep 17 00:00:00 2001 From: Sander Date: Wed, 15 Apr 2026 19:40:53 +0100 Subject: [PATCH] libghostty-vt: fix dependency path resolution errors Zigs build infra computes relatives paths to build-time executables that use `setCwd.` The logic is purely lexical and doesn't take into account symlinks, unlike `chdir` that follows symlinks. If the `cwd` resolves to a different depth, then the relative path becomes incorrect. --- nix/libghostty-vt.nix | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/nix/libghostty-vt.nix b/nix/libghostty-vt.nix index c6a78235b..eedc47e05 100644 --- a/nix/libghostty-vt.nix +++ b/nix/libghostty-vt.nix @@ -37,7 +37,23 @@ stdenv.mkDerivation (finalAttrs: { ); }; - deps = callPackage ../build.zig.zon.nix {name = "${finalAttrs.pname}-cache-${finalAttrs.version}";}; + # Zig's build runner computes relative paths from `cwd` to the build directory. + # The logic is purely lexical, so if the `cwd` is a symlink that resolves to a different depth during `chdir`, the computed path becomes incorrect. + # + # See: https://codeberg.org/ziglang/zig/issues/32121 + # + # Workaround: override `linkFarm` with a copy-farm so deps are real directories, not symlinks. + deps = callPackage ../build.zig.zon.nix { + name = "${finalAttrs.pname}-cache-${finalAttrs.version}"; + linkFarm = name: entries: + runCommand name {} '' + mkdir -p $out + ${lib.concatMapStringsSep "\n" (e: '' + cp -rL ${e.path} $out/${e.name} + '') + entries} + ''; + }; nativeBuildInputs = [