"no passwd entry for user" error after nixos-rebuild switch

Link to full repo. : ( I am currently only working on the xin specialization. The others are acting as placeholders. )

After rebuilding my configuration with
# nixos-rebuild switch --flake .#vortex
I get the following messages

reloading user units for xin...
No passwd entry for user 'xin'

After witch I cannot use sudo or commands like reboot. The system does successfully build though, and the problem is fixed after restarting my computer.

Relevant config highlights
configuration.nix

{

  imports = [ 
      ./xin-configuration.nix
  ];

...

  users.mutableUsers = false;
  security.sudo.wheelNeedsPassword = false;

...

}

xin-configuration.nix

{

  specialisation.xin.configuration = {
    system.nixos.tags = [ "xin" ];

...

    users.users.root = {
     hashedPassword = "(sha256 hash ...)"
    };

    users.users.xin = {
      isNormalUser = true;
      description = "Xin";
      uid = 1002;
      extraGroups = [ "networkmanager" "wheel" ];
      hashedPassword = "(sha256 hash ...)"
    };
  };
}

After working on this somemore it appears to be an issue with specialisations. I have tried removing the mutableUsers option and managing the password normally. I still lose the ability to use sudo after nixos-rebuild though.

I can’t really find any mention of this else where. Would this be expected behavior with specialisations?

The issue was caused by trying to create users withing the specialisation. Once I moved those into the shared configuration rebuild worked normally again.