about summary refs log tree commit diff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-03-11T15·45+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-03-11T15·45+0000
commite020d80e4e7b9c8850fbee378e7bd2118a351a50 (patch)
tree4916bac35951bd5aeed727a8bd27a736aa2d3b1b /src/libstore/build.cc
parent070057c1b9335ef2c5ff0fe12adb76e214f945ba (diff)
parent05e15049a5f42ca7222c7557d7257352fe711d2e (diff)
* Sync with the trunk.
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index d0d051f0812e..e068ab0bdd94 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1568,7 +1568,7 @@ void DerivationGoal::startBuilder()
 
         /* Create a /etc/passwd with entries for the build user and the
            nobody account.  The latter is kind of a hack to support
-           Samba-in-QEMU.  */
+           Samba-in-QEMU. */
         createDirs(chrootRootDir + "/etc");
 
         writeFile(chrootRootDir + "/etc/passwd",
@@ -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