hey @nixpix; thanks for giving this project a go & for the encouraging words. Much appreciated.
You could try to clone the repo to a location relative to your configuration.nix, and import modules/nixos.nix directly. However, I suspect things will break.
I’ll sandbox some time to try this out the upcoming weekend.
@gmodena Thank you for the pointers. The short version is that it worked!
I am writing in a bit more detail as much to document my progress but also for others who may look at this in the future.
I did what you said, specifically cloned the repo and imported it from a relative path into my configuration.nix file. I then ran sudo nixos-rebuild switch and the system rebuilt with the 3 example flatpaks that you had specified being installed. For anyone else reading this, the rebuild took far longer than usual with no visual feedback. This was due to the initial download of the flatpaks and the progress not being reported in the standard nix rebuild log. However you can confirm the download activity by monitoring network downloads during the rebuild.
I confirmed that the flatpaks were installed both by checking the applications’ icons had been installed and also running flatpak list. Both of these showed that indeed the flatpaks had been installed correctly.
The next thing I tried to do was to uninstall a flatpak by removing the reference to it from my configuration.nix file. I then rebuilt the system but unfortunately the flatpak remained installed. FYI I did try rebooting the system as well, but the installed flatpak remained installed despite being removed from the configuration.nix file.
I have two subsequent questions:
Is the inability to uninstall a flatpak a limitation of the flatpak module or is there something else I need to do in addition to the usual deletion of the item from configuration.nix and rebuilding?
Will flatpaks installed via the flatpak module automatically be updated during a nix rebuild if a new version is available on flathub (I have not pinned any specific versions and just did my testing using the three examples you used namely Brave Browser, Logseq ad Element/Riot)?
Once again thank you for your development, work and assistance. I personally feel that the addition of declarative flatpaks to nix is something that will be of immense value to the wider community.
Hey @nixpix; happy to hear you go the module working!
Regarding your questions: I should have made things more clear in the doc. Currently you can install packages declaratively, but uninstall/updates are left as a manual operation.
I’m working on both aspects (it’s something I need myself), and have done some exploration on how to best integrate flatpak lifecycle management with nix generation management.
It is straightforward to compare installed apps vs declared list at build time and uninstall accordingly. However the flatpak installation live outside the nix store, so we won’t be rollback to a previous generation of flaptaks by swapping symlinks. This can make the semantic of rollbacks a bit murky.
I’ve been reviewing how appimage and casks (nix-darwin) are managed;
The design I’m settling on is to keep flatpaks orthogonal to nix store generations, but I’ll need some more experiments with rollbacks before merging changes. I’m learning the ropes myself
Thanks for the valuable feedback, and apologies for the confusion. I created two issues to track your input at:
Hey, I think this is a great module. Unfortunately I didn’t get it to work in my Configs. I added the Input to my flake.nix and imported the module in my home.nix, but I get this Error: error: infinite recursion encountered
I didn’t have much experience yet, with flakes and modules and don’t know what I did wrong, so maybe someone here know what is wrong, here is the Link to my home.nix and flake.nix: https://drive.proton.me/urls/H4YY9KJR50#0YvoJ2Hzbl8T
On my system are of course more files and directories within my Configs, but I think, the only two files that are needed, are these two. Maybe someone here finds out, what I did wrong and can help me
To be honest I don‘t know exactly what you mean with declare in this context. I added the Things in my flake.nix, but I didn‘t have the Line with homeManafer.extraArgs and in Home-Manager I added at the beginning flake-inputs and under import I put the flake-inputs.whatever Line and under the import I added the thing with services. flatpak. All other config Files, didn‘t have the flake-inputs at all and in none of the other Configs is the import of nix-flatpak nor the services.flatpak. Sorry that the Text isn‘t the best rn I‘m on my Smartphone at the Moment
I don’t have hands on experience with that module, but looking at the doc the main differences are:
different APIs for declaring package and remote configs.
support for generational installs. From what I understand declarative-flatpak keeps the previous generation of applications around (doubling the storage required for the flatpak installation).
Re 1: I’m looking for something similar to the nix-darwin homebrew UX.
Re 2: for my use case I don’t care about keeping previous flatpak generations around. I’d be more interested in a rolling release approach, and in general I’m more constrained by disk space than bandwidth.
@gmodena, your module has inspired me to revisit my configs and I now have flakes working. I am working through rebuilding a more structured setup.
Irrespective of which direction you decide to take the module development, one other item that would be great to consider is including a status update as part of the rebuild. As I mentioned, at the moment, the rebuild works perfectly but there is no indication on the screen that flatpaks are being installed. Ideally we would be able to see installation progress (as you do when installing flatpaks natively) but even just a message on the screen noting that “flatpaks are being installed” would be helpful to new users of the module.
Please keep up the development. This is indeed a gem.
Hi @Bella109 can you please post your working config?
I have just swapped over to using flakes and I am not able to get this working. Prior to using flakes I simply cloned the entire “nix=flatpak” repo locally (as per @gmodena’s instructions) and imported it into my configuration.nix file. I am now trying to include the github module in my new set-up and I am battling. Having a chance to see your working code will likely provide a template that I can use to enable it on my system. Thank you.