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

rollback to parent #311

Open
kirelagin opened this issue Jul 27, 2014 · 13 comments
Open

rollback to parent #311

kirelagin opened this issue Jul 27, 2014 · 13 comments

Comments

@kirelagin
Copy link
Member

I've just realised that nix-env --rollback rolls back to the profile with the previous number, while I expect it to roll back to a parent.

Here is what's unnatural:

  • You have profile A.
  • Modify it to get bad (broken) profile B.
  • Rollback (you are on A now).
  • Modify it to get profile C.
  • Rollback.

At this point I expect to be on profile A while I'm on (broken) B and if I keep modifying the profile I will realise soon that all those profiles are inherently broken.

@lucabrunox
Copy link
Contributor

AFAIK there's no track of a "parent".

@kirelagin
Copy link
Member Author

Yeah, I think so.
This issue is intended to be quite a long-standing one ;).

@edolstra
Copy link
Member

Yeah, I've wanted to fix this for years. The simple solution would be to store the parent generation number in a file like /nix/var/nix/profiles/default-66-parent.

@edolstra edolstra self-assigned this Jul 28, 2014
@lucabrunox
Copy link
Contributor

@edolstra or store it in the manifest.nix? so that's even read-only

@kirelagin
Copy link
Member Author

Yeah, storing in the manifest sounds cooler. That's what I was thinking about when filing the issue.

@kirelagin
Copy link
Member Author

Hm, but there is a problem: parent is a property of the symlink, not of the profile. That is, the same profile (same hash) can be obtained from multiple parents (different users having equal profiles). Right?

@lucabrunox
Copy link
Contributor

@kirelagin if the parent is written to manifest.nix, then you can't have the same hash. Much like git commits.

@kirelagin
Copy link
Member Author

@lethalman Ah, right. But then we'll get unnecessary duplication. Maybe having an intermediate object, containing a metadata (like parent, and probably something else) and a link to the profile could work. But that complicates things a little bit.

@lucabrunox
Copy link
Contributor

@kirelagin I believe working with symlinks is more bug prone. Also it's not that we are going to use nix-env like we are using git for hot projects. It's not that you switch and then rollback every day I think. And even if you do so, there's the garbage collector and it's only about symlinks. I wouldn't bother.

There's more harmful duplication in general that simple user environments IMO

@stale
Copy link

stale bot commented Feb 16, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Feb 16, 2021
@stale
Copy link

stale bot commented Apr 29, 2022

I closed this issue due to inactivity. → More info

@stale stale bot closed this as completed Apr 29, 2022
@thufschmitt thufschmitt reopened this Feb 24, 2023
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/flakey-profile-declarative-nix-profiles-as-flakes/35163/3

@stale stale bot removed the stale label Nov 8, 2023
@iFreilicht
Copy link
Contributor

I've stumbled over this multiple times as well.

WRT storing it in the manifest, that would be a very messy solution. If you symlink to the previous generation, you can never delete any generation as they all depend on the previous one. If you simply store a name or generation index, then the profile depends on something outside of the profile.

The simple solution would be to store the parent generation number in a file like /nix/var/nix/profiles/default-66-parent.

@edolstra This would be my preferred solution as well. I'll have a look at implementing it.

zolodev pushed a commit to zolodev/nix that referenced this issue Jan 1, 2024
@edolstra edolstra removed their assignment Apr 26, 2024
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

No branches or pull requests

8 participants