about summary refs log tree commit diff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 4d542e31d32b..412640670de7 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1578,6 +1578,12 @@ void DerivationGoal::startBuilder()
                 % (buildUser.enabled() ? buildUser.getUID() : getuid())
 	        % (buildUser.enabled() ? buildUser.getGID() : getgid())).str());
 
+	/* Declare the build user's group so that programs get a consistent
+	   view of the system (e.g., "id -gn").  */
+	writeFile(chrootRootDir + "/etc/group",
+		  (format("nixbld:!:%1%:\n")
+		   % (buildUser.enabled() ? buildUser.getGID() : getgid())).str());
+
         /* Bind-mount a user-configurable set of directories from the
            host file system.  The `/dev/pts' directory must be mounted
            separately so that newly-created pseudo-terminals show