mirror of
https://github.com/NixOS/nix.git
synced 2025-11-24 11:19:35 +01:00
Dynamically allocate UIDs
Rather than rely on a nixbld group, we now allocate UIDs/GIDs dynamically starting at a configurable ID (872415232 by default). Also, we allocate 2^18 UIDs and GIDs per build, and run the build as root in its UID namespace. (This should not be the default since it breaks some builds. We probably should enable this conditional on a requiredSystemFeature.) The goal is to be able to run (NixOS) containers in a build. However, this will also require some cgroup initialisation. The 2^18 UIDs/GIDs is intended to provide enough ID space to run multiple containers per build, e.g. for distributed NixOS tests.
This commit is contained in:
parent
14227aeb32
commit
836573a9a2
2 changed files with 61 additions and 8 deletions
|
|
@ -148,6 +148,16 @@ public:
|
|||
Setting<std::string> buildUsersGroup{this, "", "build-users-group",
|
||||
"The Unix group that contains the build users."};
|
||||
|
||||
#if __linux__
|
||||
const uint32_t idsPerBuild = 1 << 18;
|
||||
|
||||
Setting<uint32_t> startId{this, 872415232, "start-id",
|
||||
"The first UID and GID to use for dynamic ID allocation. (0 means disable.)"};
|
||||
|
||||
Setting<uint32_t> uidCount{this, idsPerBuild * 128, "id-count",
|
||||
"The number of UIDs/GIDs to use for dynamic ID allocation."};
|
||||
#endif
|
||||
|
||||
Setting<bool> impersonateLinux26{this, false, "impersonate-linux-26",
|
||||
"Whether to impersonate a Linux 2.6 machine on newer kernels.",
|
||||
{"build-impersonate-linux-26"}};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue