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

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

Open
Spaghetto392 opened this issue Oct 11, 2024 · 3 comments
Open

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

Spaghetto392 opened this issue Oct 11, 2024 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@Spaghetto392
Copy link

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 gmodena added the enhancement New feature or request label Oct 13, 2024
@gmodena
Copy link
Owner

gmodena commented Oct 13, 2024

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
Copy link
Author

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.

@gmodena gmodena added this to the 0.5.0 milestone Oct 15, 2024
@gmodena gmodena modified the milestones: 0.5.0, 1.0.0 Nov 7, 2024
@gmodena
Copy link
Owner

gmodena commented Nov 16, 2024

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.

The tricky part is managing attrset merges between configurations loaded from Flatpak ini files and those declared in nix. Under the hood, nix-flatpak uses jq to handle overrides state. I’m still undecided on whether to add additional logic to this process or refactor the overrides management directly within nix expressions instead of relying on jq. jq is great, but it makes things harder to test compared pure nix.

tl;dr: this issue is still in scope, but might require a bit more effort than initially estimated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants