Created
August 19, 2022 11:38
-
-
Save TerrorJack/a56fc1e5f38a7f36d03f36a1967a6ba4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
readonly NIX_BUILD_GROUP_ID=30000 | |
readonly NIX_BUILD_GROUP_NAME=nixbld | |
readonly NIX_FIRST_BUILD_UID=30001 | |
readonly NIX_USER_COUNT=48 | |
sudo groupadd \ | |
-g "$NIX_BUILD_GROUP_ID" \ | |
--system \ | |
"$NIX_BUILD_GROUP_NAME" | |
for i in $(seq 1 "$NIX_USER_COUNT"); do | |
sudo useradd \ | |
--home-dir /var/empty \ | |
--comment "Nix build user $i" \ | |
--gid "$NIX_BUILD_GROUP_ID" \ | |
--groups "$NIX_BUILD_GROUP_NAME" \ | |
--no-user-group \ | |
--system \ | |
--shell /sbin/nologin \ | |
--uid $((NIX_FIRST_BUILD_UID + i - 1)) \ | |
--password "!" \ | |
"$NIX_BUILD_GROUP_NAME$i" | |
done | |
echo "build-users-group = $NIX_BUILD_GROUP_NAME" > ~/.config/nix/nix.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment