From 05e15049a5f42ca7222c7557d7257352fe711d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 11 Mar 2010 14:47:04 +0000 Subject: [PATCH] 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. --- src/libstore/build.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 4d542e31d..412640670 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