summaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
authorReepca Russelstein <reepca@russelstein.xyz>2026-02-07 12:13:02 -0600
committerLudovic Courtès <ludo@gnu.org>2026-06-18 16:46:53 +0200
commit2510e4e0264e3e875ab4916a8557f47bb4774d48 (patch)
tree0fac4fd62f16845ba58486c1d09b389d336d9d15 /nix
parent42f3ca07d02125ec8b82284e0f4510eb0c8b04a1 (diff)
daemon: Copy network config files into chroot instead of mounting.
Config files like /etc/services may be symbolic links to files not available in the build environment; copy them instead of creating dangling symlinks. This also reverts 425aa1bf7c35839f5e500515ff3b5a861a7533d6, which would potentially create dangling symlinks in the chroot, as reported by @cnx in guix/guix#9072. * nix/libstore/build.cc (DerivationGoal::startBuilder): copy network config files. Fixes: guix/guix#4225 Change-Id: I38fc6374c5cecdcd16de06161db00b3825688f2a Signed-off-by: Ludovic Courtès <ludo@gnu.org> Modified-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'nix')
-rw-r--r--nix/libstore/build.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index e72a0165987..85be95d557f 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -2826,11 +2826,11 @@ void DerivationGoal::startBuilder()
2826 } 2826 }
2827 for (auto & file : files) { 2827 for (auto & file : files) {
2828 if (pathExists(file)) { 2828 if (pathExists(file)) {
2829 /* On Guix System, /etc/services is a symlink; likewise, 2829 /* Copy files into chroot instead of bind-mounting in case
2830 on systemd-based system, /etc/resolv.conf is a symlink. 2830 they are symbolic links that won't resolve on the
2831 Dereference them. */ 2831 inside. */
2832 ctx.filesInChroot[file] = canonPath(file, true); 2832 string contents = readFile(file);
2833 ctx.readOnlyFilesInChroot.insert(file); 2833 writeFile(chrootRootDir + file, contents);
2834 } 2834 }
2835 } 2835 }
2836 } 2836 }