Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos: Add assertion for persisting UIDs/GIDs #188

Merged
merged 1 commit into from
Aug 19, 2024

Conversation

kuruczgy
Copy link
Contributor

@kuruczgy kuruczgy commented Jun 5, 2024

Fixes #178

@kuruczgy
Copy link
Contributor Author

Gentle reminder @talyz. Do you in general like the idea of this PR? Do you think we could find someone to review this?

The corresponding issue I opened (#178) did get attention from a couple other people as well, so it's clear that I was not the only person who ran into this issue, and this check would be useful to have.

@talyz
Copy link
Collaborator

talyz commented Aug 19, 2024

Looks really useful! Thanks! :) And sorry for the slow response!

@talyz talyz merged commit 9de98e0 into nix-community:master Aug 19, 2024
4 checks passed
@surfaceflinger
Copy link

It should be possible for this to be skipped by some option

9de98e0#commitcomment-145532610
9de98e0#commitcomment-145533686

@nakoo
Copy link

nakoo commented Aug 19, 2024

I feel this merge needs to be more aware. At least it needs to be documented.

@NickCao
Copy link

NickCao commented Aug 19, 2024

And we should check all possible parent directories, /, /var and /var/lib

@merrkry
Copy link

merrkry commented Aug 20, 2024

When parent directories like /var or /var/lib are persisted, impermanence will give false alarm and prevent rebuilding.

czerwonk added a commit to czerwonk/nixfiles that referenced this pull request Aug 20, 2024
@accelbread
Copy link

There should be a way to turn this off.
On my system, I have my own users's uid and gid set, but for the rest of the users/groups, I have no dependency on what uid/gid they have since I dont persist any files from those users.

accelbread added a commit to accelbread/config-flake that referenced this pull request Aug 20, 2024
9de98e038ae91e15ea725700386044309b340299 causes an evaluation failure.

See nix-community/impermanence#188 for details.
@kuruczgy
Copy link
Contributor Author

Oops, yeah, didn't think of that.

At least we got some quick feedback on this now (haha), but @talyz we should probably revert this as it's clearly breaking people's setups.

I might have time in a few days to work on a fixup. From the comments above I gather that:

  1. We should check all parent dirs of /var/lib/nixos, this is obvious, sorry I missed this.
  2. There should still be a way to turn it off.

If anyone has additional ideas for how a future attempt at this could be improved, please leave a comment.

talyz added a commit that referenced this pull request Aug 20, 2024
This makes the assertion consider the legitimate case of any of
/var/lib/nixos's parents being persisted. It also changes the
assertion to a warning, as it's not critical to everyone.

Fixes issues caused by #188.
@talyz
Copy link
Collaborator

talyz commented Aug 20, 2024

Yep, I agree with all of this. I've pushed a few changes to solve this now:

  • changed the assertion to a warning, since it's not critical to most people
  • include the parents directories in the check
  • added an option to toggle warnings on and off (enableWarnings)

omernaveedxyz added a commit to omernaveedxyz/nixos-config that referenced this pull request Sep 5, 2024
Persist the '/var/lib/nixos' directory in order to perist UIDs/GIDs
between boots.

REF: nix-community/impermanence#188
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.

The importance of persisting /var/lib/nixos is not documented
7 participants