I previously created a second user account by adding a section like this to my NixOS configuration:
users.users.otheruser = {
isNormalUser = true;
description = "Other User";
shell = pkgs.zsh;
extraGroups = [ "networkmanager" "wheel" ];
};
home-manager.users.otheruser = import /home/otheruser/.config/home-manager/home.nix;
I’ve since decided I don’t need this user account, so I removed the section above from my configuration, and manually ran sudo userdel -r otheruser
and sudo groupdel otheruser
as per the NixOS User Management instructions. Note I don’t have users.mutableUsers = false
set.
However, now every time I run sudo -i nixos-rebuild switch
the rebuild fails with errors like this:
error:
Failed assertions:
- Exactly one of users.users.otheruser.isSystemUser and users.users.otheruser.isNormalUser must be set.
- users.users.otheruser.group is unset. This used to default to
nogroup, but this is unsafe. For example you can create a group
for this user with:
users.users.otheruser.group = "otheruser";
users.groups.otheruser = {};
I’m quite sure my NixOS configuration is not referencing the other user account anywhere now, so I don’t know where this error is coming from?
Both user accounts were using home-manager in the NixOS module mode, with both users having the home-manager.users.username = import /path/to/home.nix
section. I’ve tried commenting out all mention of home-manager, including the import of <home-manager/nixos>
, but that doesn’t seem to have changed the result.
I’m not sure if this is a NixOS problem or a home-manager problem?
I’m running NixOS 24.05. sudo -i nix-channel --list
shows:
home-manager https://github.com/nix-community/home-manager/archive/release-24.05.tar.gz
nixos https://nixos.org/channels/nixos-24.05