summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCongcong Kuo <congcong.kuo@gmail.com>2025-10-28 01:00:58 +0800
committerLudovic Courtès <ludo@gnu.org>2025-11-04 17:59:19 +0100
commit0ef4d33da96fc6d953070fbefd74e1cd42ad58d8 (patch)
tree79dc99f2ffa3c246a87be166510bef7fcbfd6ee7
parent9d5f3c6b3a130adcd0031526d35e3e0a170d488f (diff)
daemon: Fix compilation error while using Zig (LLVM)
* nix/libstore/build.cc (guestUID, guestGID): Rename to 'defaultGuestUID' and 'defaultGuestGID' respectively. (initializeUserNamespace, DerivationGoal::startBuilder): Rename references to variables accordingly. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--nix/libstore/build.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index b3f9c24983c..9010ca4e200 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -1638,15 +1638,15 @@ void chmod_(const Path & path, mode_t mode)
/* UID and GID of the build user inside its own user namespace. */
-static const uid_t guestUID = 30001;
-static const gid_t guestGID = 30000;
+static const uid_t defaultGuestUID = 30001;
+static const gid_t defaultGuestGID = 30000;
/* Initialize the user namespace of CHILD. */
static void initializeUserNamespace(pid_t child,
uid_t hostUID = getuid(),
gid_t hostGID = getgid(),
- uid_t guestUID = guestUID,
- gid_t guestGID = guestGID,
+ uid_t guestUID = defaultGuestUID,
+ gid_t guestGID = defaultGuestGID,
const std::vector<std::pair<gid_t, gid_t>> extraGIDs = {},
bool haveCapSetGID = false)
{
@@ -2763,14 +2763,14 @@ void DerivationGoal::startBuilder()
std::format(
"nixbld:x:{}:{}:Nix build user:/:/noshell\n"
"nobody:x:65534:65534:Nobody:/:/noshell\n",
- buildUser.enabled() ? buildUser.getUID() : guestUID,
- buildUser.enabled() ? buildUser.getGID() : guestGID));
+ buildUser.enabled() ? buildUser.getUID() : defaultGuestUID,
+ buildUser.enabled() ? buildUser.getGID() : defaultGuestGID));
/* Declare the build user's group so that programs get a consistent
view of the system (e.g., "id -gn"). */
writeFile(chrootRootDir + "/etc/group",
std::format("nixbld:!:{}:\n",
- buildUser.enabled() ? buildUser.getGID() : guestGID));
+ buildUser.enabled() ? buildUser.getGID() : defaultGuestGID));
if (fixedOutput) {
/* Fixed-output derivations typically need to access the network,
@@ -3020,7 +3020,7 @@ void DerivationGoal::startBuilder()
auto extraGIDs = kvmGIDMapping();
initializeUserNamespace(pid,
getuid(), getgid(),
- guestUID, guestGID, extraGIDs);
+ defaultGuestUID, defaultGuestGID, extraGIDs);
writeFull(parentSetupSocket, (unsigned char*)"go\n", 3);
}