-
Notifications
You must be signed in to change notification settings - Fork 10
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 overrides management #24
Conversation
Here's an example usage of this from my configs: {
services.flatpak.overrides = {
global = {
# Force Wayland by default
Context.sockets = ["wayland" "!x11" "!fallback-x11"];
Environment = {
# Fix un-themed cursor in some Wayland apps
XCURSOR_PATH = "/run/host/user-share/icons:/run/host/share/icons";
# Force correct theme for some GTK apps
GTK_THEME = "Adwaita:dark";
};
};
"com.visualstudio.code".Context = {
filesystems = [
"xdg-config/git:ro" # Expose user Git config
"/run/current-system/sw/bin:ro" # Expose NixOS managed software
];
sockets = [
"gpg-agent" # Expose GPG agent
"pcsc" # Expose smart cards (i.e. YubiKey)
];
};
"org.onlyoffice.desktopeditors".Context.sockets = ["x11"]; # No Wayland support
};
} |
Technical question: Is the |
Good catch! Yes, it should create the directory if it doesn't exist, I'll fix that. |
@gmodena in the spirit of #23 (comment), should another option be exposed that will do a similar thing with overrides? F.e. an option called |
Hey @Tomaszal
I like the idea but I share the quoted sentiment. I don't see an obvious use case for |
I've rebased this onto the latest changes in #23 which now include some small changes that were previously here. I also added an |
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.
This branch has conflicts that must be resolved
@Tomaszal I merged #23 and now there is a conflict with this PR and main
.
I resolved the merge conflict locally and was able to test your latest update. Everything seems to be working as expected.
Happy to merge once the merge this PR once the merge conflict is resolved in #24.
I refrained from pushing my local changes to avoid disrupting your PR and eventual ongoing work. Holler if you want me to go ahead with resolving and merging.
Thanks again for your contributions, and for taking the time to work through #23 and #24! Much appreciated.
I plan to cut a release in the upcoming days (after a little more battle testing).
@gmodena I've resolved the merge conflict with I realise now that there's probably a bug similar to the one you fixed in #28 with this, where on new installations |
Hey @Tomaszal
Agree. +1 to do this in a dedicated PR. |
This PR builds on top of PR #23, as it relies on a similar strategy to separately manage the declarative and imperative states. If/when that PR is merged I'll rebase this PR to only include the relevant commit.
This wasn't a trivial task and was mainly accomplished using jq, the logic of which has been separated into the
modules/overrides.jq
file. The installer simply provides the needed values to it by looping over previously and currently managed overrides, then reading their active (the actual Flatpak overrides files), old and new states (the files introduced in #23) from the respective files.The actual logic to determine a value for an overrides entry is quite simple:
active - old + new