about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2010-03-11T14·47+0000
committerLudovic Courtès <ludo@gnu.org>2010-03-11T14·47+0000
commit05e15049a5f42ca7222c7557d7257352fe711d2e (patch)
tree9d14e1c849e0cb7e1725f1859465c714049d1a3a /src
parentc752c9f41aa88ff2129cdc0863fe74f76328835c (diff)
Show the build user's group in /etc/group in chroots.
* src/libstore/build.cc (nix::DerivationGoal::startBuilder): Create
  /etc/group showing the build user's group.
Diffstat (limited to 'src')
-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