Skip to content

Commit b39884c

Browse files
committed
Fix Windows cross-build: tzdata chmod ordering, ngtcp2 examples
tzdata: stdenv's unpackPhase runs `chmod -R u+w "$sourceRoot"` BEFORE postUnpack, so the previous fix (creating tzdata-src in postUnpack) failed because chmod ran on a nonexistent directory. Fix: set dontMakeSourcesWritable=true and run chmod manually in postUnpack. ngtcp2: examples include POSIX-only headers (sys/socket.h, sys/un.h) that don't exist on Windows (same class of issue as nghttp3). Disable examples with ENABLE_EXAMPLES=OFF.
1 parent d448991 commit b39884c

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

flake.nix

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,23 @@
6161
# macOS builders via Rosetta, where Determinate Nix's sandbox
6262
# behaves differently from Linux.
6363
mingw = (final: prev: prev.lib.optionalAttrs prev.stdenv.hostPlatform.isWindows {
64-
# tzdata tarballs extract into '.' (sourceRoot="."). On macOS
65-
# builders with Determinate Nix, the sandbox places a read-only
66-
# builder.json in the build directory. stdenv's genericBuild
67-
# unconditionally runs `chmod +x $sourceRoot` after unpackPhase
68-
# (to ensure cd works), which fails on '.' because the sandbox
69-
# prevents permission changes on the build dir. Fix: extract
70-
# into a subdirectory so sourceRoot != '.'.
64+
# tzdata tarballs extract into '.' (no subdirectory). stdenv's
65+
# unpackPhase runs `chmod -R u+w "$sourceRoot"` BEFORE postUnpack,
66+
# so setting sourceRoot="tzdata-src" with a postUnpack to create
67+
# the directory fails (chmod runs on nonexistent dir). Fix: skip
68+
# the automatic chmod and handle it manually in postUnpack.
7169
tzdata = prev.tzdata.overrideAttrs (_: {
7270
sourceRoot = "tzdata-src";
71+
dontMakeSourcesWritable = true;
7372
postUnpack = ''
7473
mkdir -p tzdata-src
75-
# Move everything except builder.json into subdirectory
7674
for f in *; do
7775
case "$f" in
7876
tzdata-src|builder.json|env-vars) ;;
7977
*) mv "$f" tzdata-src/ ;;
8078
esac
8179
done
80+
chmod -R u+w tzdata-src
8281
'';
8382
});
8483

@@ -106,6 +105,15 @@
106105
(prev.lib.cmakeBool "ENABLE_LIB_ONLY" true)
107106
];
108107
});
108+
109+
# ngtcp2 examples include POSIX-only headers (sys/socket.h,
110+
# sys/un.h) that don't exist on Windows. The library itself
111+
# builds fine; only the example client/server programs fail.
112+
ngtcp2 = prev.ngtcp2.overrideAttrs (old: {
113+
cmakeFlags = (old.cmakeFlags or []) ++ [
114+
(prev.lib.cmakeBool "ENABLE_EXAMPLES" false)
115+
];
116+
});
109117
});
110118

111119
musl = (final: prev: prev.lib.optionalAttrs prev.stdenv.hostPlatform.isMusl {

0 commit comments

Comments
 (0)