Nix creates build users on non NixOS system (arch)

Hi,

I installed nix using the zero to nix install script and then enabled the daemon with systemctl enable nix-daemon but now I have a ton of nix build users’s showing in my login manager…of course I can also see them with less /etc/passwd.

I was not able to figure out why they are created, I only found some NixOS related questions about nix build users…so I have the following questions:

  1. why were these users created, for what purpose, did I do something wrong ?
  2. how can I get rid of them, or in case they are required for something can I hide them from the login manager ?

I only installed nix via the script enabled the daemon and also used nix-shell, nix repl, nix develop nix flake init and nix-instanciate so far (used these when learning about nix).

These are the relevant users from /etc/passwd:

nixbld1:x:30001:30000:Nix build user 1:/var/empty:/sbin/nologin
nixbld2:x:30002:30000:Nix build user 2:/var/empty:/sbin/nologin
nixbld3:x:30003:30000:Nix build user 3:/var/empty:/sbin/nologin
nixbld4:x:30004:30000:Nix build user 4:/var/empty:/sbin/nologin
nixbld5:x:30005:30000:Nix build user 5:/var/empty:/sbin/nologin
nixbld6:x:30006:30000:Nix build user 6:/var/empty:/sbin/nologin
nixbld7:x:30007:30000:Nix build user 7:/var/empty:/sbin/nologin
nixbld8:x:30008:30000:Nix build user 8:/var/empty:/sbin/nologin
nixbld9:x:30009:30000:Nix build user 9:/var/empty:/sbin/nologin
nixbld10:x:30010:30000:Nix build user 10:/var/empty:/sbin/nologin
nixbld11:x:30011:30000:Nix build user 11:/var/empty:/sbin/nologin
nixbld12:x:30012:30000:Nix build user 12:/var/empty:/sbin/nologin
nixbld13:x:30013:30000:Nix build user 13:/var/empty:/sbin/nologin
nixbld14:x:30014:30000:Nix build user 14:/var/empty:/sbin/nologin
nixbld15:x:30015:30000:Nix build user 15:/var/empty:/sbin/nologin
nixbld16:x:30016:30000:Nix build user 16:/var/empty:/sbin/nologin
nixbld17:x:30017:30000:Nix build user 17:/var/empty:/sbin/nologin
nixbld18:x:30018:30000:Nix build user 18:/var/empty:/sbin/nologin
nixbld19:x:30019:30000:Nix build user 19:/var/empty:/sbin/nologin
nixbld20:x:30020:30000:Nix build user 20:/var/empty:/sbin/nologin
nixbld21:x:30021:30000:Nix build user 21:/var/empty:/sbin/nologin
nixbld22:x:30022:30000:Nix build user 22:/var/empty:/sbin/nologin
nixbld23:x:30023:30000:Nix build user 23:/var/empty:/sbin/nologin
nixbld24:x:30024:30000:Nix build user 24:/var/empty:/sbin/nologin
nixbld25:x:30025:30000:Nix build user 25:/var/empty:/sbin/nologin
nixbld26:x:30026:30000:Nix build user 26:/var/empty:/sbin/nologin
nixbld27:x:30027:30000:Nix build user 27:/var/empty:/sbin/nologin
nixbld28:x:30028:30000:Nix build user 28:/var/empty:/sbin/nologin
nixbld29:x:30029:30000:Nix build user 29:/var/empty:/sbin/nologin
nixbld30:x:30030:30000:Nix build user 30:/var/empty:/sbin/nologin
nixbld31:x:30031:30000:Nix build user 31:/var/empty:/sbin/nologin
nixbld32:x:30032:30000:Nix build user 32:/var/empty:/sbin/nologin

I don’t want to use nix as my main package manager, I only want to use it instead of the AUR for packages that I can’t install with pacman and also mainly for development environments so I don’t pollute my system.

I really don’t know much about nix. Thank you in advance for help.

See here: Multi-User Mode - Nix Reference Manual

Technically you could do a single user installation, but this is off the beaten path so you’ll probably run into lots of problems doing that. I think most installers don’t support that anymore.

Your login manager is supposed to hide these users; their UID range is supposed to be in a block that the system considers “system” users (read the comment, follow the links, Arch will do something equivalent): nixpkgs/nixos/modules/misc/ids.nix at 2e1715cf7cf3c1e79436d566962aeedaffbfb49d · NixOS/nixpkgs · GitHub

Arch is probably just not set up to consider that UID range “system” users. You’ll have to consult the arch wiki on how to change that, it might be in your login manager’s documentation, or perhaps it’s supposed to be done with kernel settings; I don’t know the details of your setup.

thank you! I now understand the build users a bit better and also that having so many (32 default) is not a problem, initially I thought that I messed something up because there were so many but they exist for concurrent building from what I understood now.

So there is no issue with my nix, just my window manager, I also found this:

Closing this now, sorry should have probably done more research before. Thank you for the explanation and links!

2 Likes

Could have, don’t apologize, nothing wrong with getting lost in documentation.

This forum is for asking questions, the resulting discourse post with high search ranking will save lots of users time in the future :wink:

3 Likes