gmodena / nix-flatpak

Install flatpaks declaratively
Apache License 2.0
302 stars 10 forks source link

Add the ability to specify an overrides file directory. #82

Open Spaghetto392 opened 1 week ago

Spaghetto392 commented 1 week ago

A number of NixOS options allow a user to specify a file instead of writing one as a nix expression for configuration, e.g. services.usbguard.ruleFile, security.pki.certificateFiles, etc. This can be useful if a user, for example already has a large number of pre-written configurations for whatever program they are using.

In my case, I have a number of Flatpak override config files already present on my device. It would be very useful if I could simply drop them in a folder as part of my OS config. This would also allow users to use tools they are already familiar with, when configuring Flatpak overrides, e.g. flatseal, and the built in configuration tool present on KDE.

gmodena commented 5 days ago

Hey @Spaghetto392,

Good proposal. I think this is useful and should not be hard to implement.

Currently, services.flatpak.overrides is just a Nix attrSet. I need to experiment a bit, but you should be able to split the configs across multiple files and assemble them at build time.

However, this doesn’t directly solve your problem. To load unmanaged (= not declared in nix-flatpak) overrides, you'll need to convert flatpak ini files to nix. There’s some ini-wrangling in #78 that might be useful for this feature.

Just to understand your use case better: how do you currently manage override files? Do you keep them version controlled outside of $XDG_DATA_HOME/flatpak/overrides?

Spaghetto392 commented 5 days ago

Hi @gmodena,

As it currently stands I don't really manage override files. I mostly just set them and forget them, which I know, isn't particularly great, but I haven't really had the time to setup anything more sophisticated. I've considered using something like the nextcloud sync client to add them to each of my devices, but have to consider if any of the configuration would need to be changed on a by device basis.

What I would like to do, is put my premade overrides into a directory as part of my nix repo, and have them be auto deployed system wide or perhaps per user.