@@ -25,9 +25,9 @@ readonly RED='\033[31m'
2525readonly NIX_USER_COUNT=${NIX_USER_COUNT:- 32}
2626readonly NIX_BUILD_GROUP_ID=" ${NIX_BUILD_GROUP_ID:- 30000} "
2727readonly NIX_BUILD_GROUP_NAME=" nixbld"
28- # darwin installer needs to override these
29- NIX_FIRST_BUILD_UID= " ${NIX_FIRST_BUILD_UID :- 30001} "
30- NIX_BUILD_USER_NAME_TEMPLATE= " nixbld%d "
28+ # each system specific installer must set these:
29+ # NIX_FIRST_BUILD_UID
30+ # NIX_BUILD_USER_NAME_TEMPLATE
3131# Please don't change this. We don't support it, because the
3232# default shell profile that comes with Nix doesn't support it.
3333readonly NIX_ROOT=" /nix"
707707 fi
708708}
709709
710+ check_required_system_specific_settings () {
711+ if [ -z " ${NIX_FIRST_BUILD_UID+x} " ] || [ -z " ${NIX_BUILD_USER_NAME_TEMPLATE+x} " ]; then
712+ failure " Internal error: System specific installer for $( uname) ($1 ) does not export required settings."
713+ fi
714+ }
715+
710716welcome_to_nix () {
711717 local -r NIX_UID_RANGES=" ${NIX_FIRST_BUILD_UID} ..$(( NIX_FIRST_BUILD_UID + NIX_USER_COUNT - 1 )) "
712718 local -r RANGE_TEXT=$( echo -ne " ${BLUE} (uids [${NIX_UID_RANGES} ])${ESC} " )
@@ -726,7 +732,9 @@ manager. This will happen in a few stages:
726732 if you are ready to continue.
727733
7287343. Create the system users ${RANGE_TEXT} and groups ${GROUP_TEXT}
729- that the Nix daemon uses to run builds.
735+ that the Nix daemon uses to run builds. To create system users
736+ in a different range, exit and run this tool again with
737+ NIX_FIRST_BUILD_UID set.
730738
7317394. Perform the basic installation of the Nix files daemon.
732740
@@ -968,13 +976,16 @@ main() {
968976 if is_os_darwin; then
969977 # shellcheck source=./install-darwin-multi-user.sh
970978 . " $EXTRACTED_NIX_PATH /install-darwin-multi-user.sh"
979+ check_required_system_specific_settings " install-darwin-multi-user.sh"
971980 elif is_os_linux; then
972981 # shellcheck source=./install-systemd-multi-user.sh
973982 . " $EXTRACTED_NIX_PATH /install-systemd-multi-user.sh" # most of this works on non-systemd distros also
983+ check_required_system_specific_settings " install-systemd-multi-user.sh"
974984 else
975985 failure " Sorry, I don't know what to do on $( uname) "
976986 fi
977987
988+
978989 welcome_to_nix
979990
980991 if ! is_root; then
0 commit comments