···111111 };
112112 };
113113114114- # DNS fails for QEMU user networking (SLiRP) on macOS. See:
115115- #
116116- # https://github.com/utmapp/UTM/issues/2353
117117- #
118118- # This works around that by using a public DNS server other than the DNS
119119- # server that QEMU provides (normally 10.0.2.3)
120120- networking.nameservers = [ "8.8.8.8" ];
121121-122114 # The linux builder is a lightweight VM for remote building; not evaluation.
123115 nix.channel.enable = false;
124116
+46
pkgs/by-name/li/libslirp/fix-dns-for-darwin.patch
···11+From 735904142f95d0500c0eae6bf763e4ad24b6b9fd Mon Sep 17 00:00:00 2001
22+From: Samuel Thibault <samuel.thibault@ens-lyon.org>
33+Date: Wed, 26 Mar 2025 08:42:35 +0100
44+Subject: [PATCH] apple: Fix getting IPv4 DNS server address when IPv4 and IPv4
55+ are interleaved
66+77+When getting an IPv4 DNS server address, if libresolv returns
88+99+IPv4
1010+IPv6
1111+IPv4
1212+IPv6
1313+1414+(or just IPv4 and IPv6)
1515+1616+we would still have found == 1 on the second iteration and thus take the
1717+IPv6 even if it's not the proper af. We can as well just completely ignore
1818+the non-matching af entries.
1919+2020+Fixes #85
2121+---
2222+ src/slirp.c | 7 +++++--
2323+ 1 file changed, 5 insertions(+), 2 deletions(-)
2424+2525+diff --git a/src/slirp.c b/src/slirp.c
2626+index bccee53..62a018a 100644
2727+--- a/src/slirp.c
2828++++ b/src/slirp.c
2929+@@ -289,9 +289,12 @@ static int get_dns_addr_libresolv(int af, void *pdns_addr, void *cached_addr,
3030+ found = 0;
3131+ DEBUG_MISC("IP address of your DNS(s):");
3232+ for (int i = 0; i < count; i++) {
3333+- if (af == servers[i].sin.sin_family) {
3434+- found++;
3535++ if (af != servers[i].sin.sin_family) {
3636++ continue;
3737+ }
3838++
3939++ found++;
4040++
4141+ if (af == AF_INET) {
4242+ addr = &servers[i].sin.sin_addr;
4343+ } else { // af == AF_INET6
4444+--
4545+GitLab
4646+
+6
pkgs/by-name/li/libslirp/package.nix
···2020 sha256 = "sha256-Eqdw6epFkLv4Dnw/s1pcKW0P70ApZwx/J2VkCwn50Ew=";
2121 };
22222323+ patches = [
2424+ # https://gitlab.freedesktop.org/slirp/libslirp/-/commit/735904142f95d0500c0eae6bf763e4ad24b6b9fd
2525+ # Vendorized due to frequent instability of the upstream repository.
2626+ ./fix-dns-for-darwin.patch
2727+ ];
2828+2329 separateDebugInfo = true;
24302531 nativeBuildInputs = [