Nix-darwin Sequoia nixbld users migration

 · 4 min · torgeir

Nix-darwin needed to move its builder users to work with macos Sequoia.

Nix Macos

When rebuilding the nix-darwin system the other day I was met with this error instead of a rebuilt system.

clear; darwin-rebuild switch --flake ~/.config/nix-darwin
warning: Git tree '/Users/torgeir/.config/nix-darwin' is dirty
building the system configuration...
warning: Git tree '/Users/torgeir/.config/nix-darwin' is dirty
error: Build users have unexpected UIDs, aborting activation
The default Nix build user ID range has been adjusted for
compatibility with macOS Sequoia 15. Your _nixbld1 user currently has
UID 301 rather than the new default of 351.

You can automatically migrate the users with the following command:

curl --proto '=https' --tlsv1.2 -sSf -L https://github.com/NixOS/nix/raw/master/scripts/sequoia-nixbld-user-migration.sh | bash -

If you have no intention of upgrading to macOS Sequoia 15, or already
have a custom UID range that you know is compatible with Sequoia, you
can disable this check by setting:

ids.uids.nixbld = 300;

Seems macos Sequoia takes 4 UIDs of in the range that nix uses for its builder users. I’m not on Sequoia yet - still on Sonoma 14.6.1 (23G93) - but I reviewed the script and ran it. Seemed reasonable enough, and worked fine.

curl --proto '=https' --tlsv1.2 -sSf -L https://github.com/NixOS/nix/raw/master/scripts/sequoia-nixbld-user-migration.sh | bash -                            2m 4s
Attempting to migrate _nixbld users.

Step 1: move existing _nixbld users out of the destination UID range.
Temporarily moved _nixbld1 from uid 301 -> 31000
Temporarily moved _nixbld2 from uid 302 -> 31001
Temporarily moved _nixbld3 from uid 303 -> 31002
Temporarily moved _nixbld4 from uid 304 -> 31003
Temporarily moved _nixbld5 from uid 305 -> 31004
Temporarily moved _nixbld6 from uid 306 -> 31005
Temporarily moved _nixbld7 from uid 307 -> 31006
Temporarily moved _nixbld8 from uid 308 -> 31007
Temporarily moved _nixbld9 from uid 309 -> 31008
Temporarily moved _nixbld10 from uid 310 -> 31009
Temporarily moved _nixbld11 from uid 311 -> 31010
Temporarily moved _nixbld12 from uid 312 -> 31011
Temporarily moved _nixbld13 from uid 313 -> 31012
Temporarily moved _nixbld14 from uid 314 -> 31013
Temporarily moved _nixbld15 from uid 315 -> 31014
Temporarily moved _nixbld16 from uid 316 -> 31015
Temporarily moved _nixbld17 from uid 317 -> 31016
Temporarily moved _nixbld18 from uid 318 -> 31017
Temporarily moved _nixbld19 from uid 319 -> 31018
Temporarily moved _nixbld20 from uid 320 -> 31019
Temporarily moved _nixbld21 from uid 321 -> 31020
Temporarily moved _nixbld22 from uid 322 -> 31021
Temporarily moved _nixbld23 from uid 323 -> 31022
Temporarily moved _nixbld24 from uid 324 -> 31023
Temporarily moved _nixbld25 from uid 325 -> 31024
Temporarily moved _nixbld26 from uid 326 -> 31025
Temporarily moved _nixbld27 from uid 327 -> 31026
Temporarily moved _nixbld28 from uid 328 -> 31027
Temporarily moved _nixbld29 from uid 329 -> 31028
Temporarily moved _nixbld30 from uid 330 -> 31029
Temporarily moved _nixbld31 from uid 331 -> 31030
Temporarily moved _nixbld32 from uid 332 -> 31031

Step 2: re-create missing early _nixbld# users.

Step 3: relocate remaining _nixbld# UIDs to 351+
_nixbld1 migrated to uid: 351
_nixbld2 migrated to uid: 352
_nixbld3 migrated to uid: 353
_nixbld4 migrated to uid: 354
_nixbld5 migrated to uid: 355
_nixbld6 migrated to uid: 356
_nixbld7 migrated to uid: 357
_nixbld8 migrated to uid: 358
_nixbld9 migrated to uid: 359
_nixbld10 migrated to uid: 360
_nixbld11 migrated to uid: 361
_nixbld12 migrated to uid: 362
_nixbld13 migrated to uid: 363
_nixbld14 migrated to uid: 364
_nixbld15 migrated to uid: 365
_nixbld16 migrated to uid: 366
_nixbld17 migrated to uid: 367
_nixbld18 migrated to uid: 368
_nixbld19 migrated to uid: 369
_nixbld20 migrated to uid: 370
_nixbld21 migrated to uid: 371
_nixbld22 migrated to uid: 372
_nixbld23 migrated to uid: 373
_nixbld24 migrated to uid: 374
_nixbld25 migrated to uid: 375
_nixbld26 migrated to uid: 376
_nixbld27 migrated to uid: 377
_nixbld28 migrated to uid: 378
_nixbld29 migrated to uid: 379
_nixbld30 migrated to uid: 380
_nixbld31 migrated to uid: 381
_nixbld32 migrated to uid: 382
Migrated 32 users. If you want to double-check, try:
dscl . list /Users UniqueID | grep _nixbld | sort -n -k2

For the record, I ran this version of it

https://github.com/NixOS/nix/blob/8b2ffbae3adc2418a6221c24619d9bca51852d05/scripts/sequoia-nixbld-user-migration.sh

Another rebuild results in no more errors! ✅

Resources