Manage Flatpak overrides with settings and files
mainYou can modify application permissions and environment variables using two methods. Warning: Using these settings will overwrite existing system/user Flatpak override files. Backup your files first.
Inline Settings
Use services.flatpak.overrides.settings to declare overrides directly in Nix. This is useful for environment variables and context settings (sockets, filesystems, etc.).
External Files
Use services.flatpak.overrides.files to load standard Flatpak override INI files. The filename must match the application ID (e.g., com.visualstudio.code).
Merging and Precedence
If both are used for the same application, they are merged. settings take precedence over files. Both are merged with any existing overrides on disk.
Write Modes
"merge"(default): Merges Nix-managed settings with existing on-disk files. User edits to non-Nix keys are preserved."replace": The file is computed as a pure store derivation and replaces the on-disk file entirely.nix-flatpakfully owns the file; manual edits will be overwritten.
# Example: Combining settings and files
{
services.flatpak.overrides = {
files = [ "/path/to/overrides.d/com.visualstudio.code" ];
settings."com.visualstudio.code".Context.sockets = ["gpg-agent"];
};
}