-
Notifications
You must be signed in to change notification settings - Fork 13
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
Only uninstall packages managed by this module #23
Conversation
Just realized I also had to change the entry point for the home manager activation script to be after |
Thanks for this patch @Tomaszal ! I need to review and do some integration tests, but I love what you did here.
FWIW: this was a (poorly documented) conscious design choice. The assumption would be that flatpaks would be installed and managed only via configuration files. So, at any point in time we can understand the state of a system by inspecting said config. However, I do agree that his maximalist approach is not pragmatic. IMHO we should add a module level configuration What do you think @Tomaszal ? Is it something you'd like doing in this PR? Totally fine if not, I'm good to merge as-is and add the |
Great catch! Fine by me to keep everything in this commit. I'll file a bug and link to the fix in this MR in the next release.
+1 to not worry about this issue for now. I'd rather keep a list of known issues, than juggling multiple implementations that express divergent behaviour. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Tested on linux and darwin.
Left a couple of nits in review and on the issue thread.
@@ -1,20 +1,28 @@ | |||
{ cfg, pkgs, lib, installation ? "system", ... }: | |||
|
|||
let | |||
gcroots = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you maybe add a comment here wrt the risk of stateFile not getting GCed?
Not a concern for now IMHO (see comments in thread), but I'd like to be reminded of this..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah makes sense, will add it
Thanks for the review @gmodena!
I could definitely add that as a part of this PR, though there's probably a better name for it than |
Ack. I can see how the semantic of |
Hey @Tomaszal . I wanted to touch base and ask if you still have the bandwidth/interest to work on this aspect. No rush, but I'd love to have the work you did in this MR merged and released.
|
Hi @gmodena, sorry for disappearing, I've been a bit busy with life the past couple of weeks. I'm more free now though so I'll try to add the changes very soon. I'll let you know if it's problematic, but I think it ( |
@gmodena added the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I think the way you handle old/new state is neat. Running some tests now, but if it all works as expected we can merge.
First of all thanks for creating this module! Convergent mode feels like the right the approach of combining Flatpak and NixOS to me, so I'm happy this exists.
Before this PR, there was an issue of packages being overridden on activation of the module, meaning if packages were installed outside of this module, they would get uninstalled on the next activation, and only the packages declared in this module would be left. This felt like a design flaw to me so I decided to fix it, I hope you agree and that this was not an intentional design choice.
This PR introduces a state file that keeps track of the module's modifications, so that they can be managed separately from imperatively introduced modifications. This is largely inspired by the way home manager handles dconf settings. However, this module needs to work for both system and user installations, so it cannot rely on the home manager activation flow. To work around that, I put a symlink to the state file in the
gcroots
folder of the respective installation, which prevents it from being garbage collected. I couldn't find any conventions on how this should be handled, so it could probably be improved in the future. The only issue I can currently see with this approach is that the state file derivation would not be being garbage collected even if this module is removed. This would be easy to solve with home manager, but then it would need a separate implementation depending on the installation. Anyway, this shouldn't be too big of an issue, as it's just a text file that doesn't link to anything else that won't be garbage collected.The state file is a JSON object so that more data can be added later. This is relevant as I would like to work on implementing overrides in this module in a similar fashion if this goes through. That way the state of the overrides could be stored in the same file.