Skip to content

Conversation

@lovesegfault
Copy link
Contributor

Description

Follow-up to #8284 addressing the discussion about making home.uid mandatory.

This PR makes home.uid required for users with stateVersion 26.05 or later

Who is affected

Users with stateVersion >= 26.05 who don't have home.uid set:

  1. Standalone users - Must set home.uid manually
  2. NixOS/nix-darwin users without explicit users.users.<name>.uid - The module only auto-discovers when uid is explicitly set in the system config. Users relying on auto-assigned UIDs must either:
    • Set users.users.<name>.uid explicitly in their NixOS/nix-darwin config, OR
    • Set home.uid directly in their home-manager config

Checklist

  • Change is backwards compatible.

  • Code formatted with nix fmt or
    nix-shell -p treefmt nixfmt deadnix keep-sorted --run treefmt.

  • Code tested through nix run .#tests -- test-all or
    nix-shell --pure tests -A run.all.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.
    • Generate a news entry. See News
    • Basic tests added. See Tests
  • If this PR adds an exciting new feature or contains a breaking change.

    • Generate a news entry. See News

@home-manager-ci home-manager-ci bot requested a review from rycee December 4, 2025 18:41
@lovesegfault
Copy link
Contributor Author

cc. @teto

Make home.uid mandatory for users with stateVersion 26.05 or later.
This follows up on the addition of home.uid in a521eab, addressing
the discussion about making the option required.

When using Home Manager as a NixOS or nix-darwin module, home.uid is
automatically set from users.users.<name>.uid when that option is
defined. For standalone usage or when the system user has no explicit
UID, users must now set home.uid directly.
Copy link
Collaborator

@khaneliman khaneliman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't even aware of #8284 and based on initial #8291 seems to be premature to mandate and is basically required already.

Copy link
Contributor

@ambroisie ambroisie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we want it to be required? I can see why some users would want to use it in their downstream configuration (one example that comes to mind is to set the secrets' path when using agenix, as mentioned in #8284 (comment)). However I don't think home-manager itself should require it, and most use-cases for knowing the UID can actually just rely on e.g: XDG_RUNTIME_DIR and other such values.

@teto
Copy link
Collaborator

teto commented Dec 5, 2025

Making this significantly raises the bar to setup home-manager IMO so it would be good to know the benefits before making it mandatory. If benefits are small maybe it's simpler for users to specialcase modules depending on wether the value is set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants