Skip to content

Fails to reproduce macOS UID/GID (context: mounting a foreign filesystem) #14508

@wq9578

Description

@wq9578

Describe the bug

The user ID and group ID typically used on a Mac cannot be reproduced, in this case required for properly mounting a filesystem created under macOS.

Typical (default?) values are:

uid=501(mac)
gid=20(staff)

Steps To Reproduce

  1. Uncomment the line after each of the two # The following line should work: (and comment those with conflicting values) in /etc/nixos/configuration.nix.
  2. Run nixos-rebuild switch .
  users = {
    # === Groups ===
    groups = {
      staff = {
        # The following line should work:
        # gid = 20;
        gid = 2000;
      };
    };

    # === Users ===
    users = {
      mac = {
        # The following line should work:
        # isNormalUser = true;
        uid = 501;
        group = "staff";
      };
    };
  };

Results:

       error:
       Failed assertions:
       - A user cannot have a users.users.mac.uid set below 1000 and set users.users.mac.isNormalUser.
       Either users.users.mac.isSystemUser must be set to true instead of users.users.mac.isNormalUser
       or users.users.mac.uid must be changed to 1000 or above.
       error:
       Failed assertions:
       - UIDs and GIDs must be unique!

Expected behavior

Working with UID 501 (as normal user) and GID 20 flawlessly.

The threshold for normal users should be adjustable (e.g., set to 500), as well as the default group table editable (even before NixOS installation on a hard disk) such that GID 20 is not allocated in advance.

Metadata

$ nix-env --version
nix-env (Nix) 2.28.5

Additional context

The problem appeared when trying to mount a filesystem created under macOS.
Instead of (mac:staff) something like (501:lp) was shown for (UID:GID).

NixOS ideally should provide full reproducibility, including for properly mounting all kinds of filesystems (including images) created by other operating systems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions