Groupadd cannot open /etc/group

I am using nixos/nix:latest and try to create a new group and a new user. When running groupadd I get the following error: groupadd: cannot open /etc/group; executor failed running [/bin/sh -c groupadd test]: exit code: 10 I followed what has been said in this thread and the Dockerfile looks like that

FROM nixos/nix
RUN nix-channel --update
RUN nix-build -A pythonFull '<nixpkgs>'
RUN nix-env -iA nixpkgs.shadow
RUN groupadd test

Is there a way around this?

You must use users.group to add a new group and then rebuild your system