https://github.com/gmodena/nix-flatpak
Setup
services.flatpak.enable = true;
inputs = {
# ...
nix-flatpak.url = "github:gmodena/nix-flatpak"; # unstable branch. Use github:gmodena/nix-flatpak/?ref=<tag> to pin releases.
};
outputs = { nix-flatpak, ... }: {
nixosConfigurations.<host> = nixpkgs.lib.nixosSystem {
modules = [
nix-flatpak.nixosModules.nix-flatpak
./configuration.nix
];
};
};
Declare flatpaks
services.flatpak.packages = [
{ appId = "com.brave.Browser"; origin = "flathub"; }
"com.obsproject.Studio"
"im.riot.Riot"
];
Updates
By default, nixos-rebuild switch will not update your flatpaks. You can have
it do this with:
services.flatpak.update.onActivation = true;
Alternatively, you can use the periodic update feature which will make it so
your nixos-rebuild switch command will update flatpaks if a certain amount of
time has passed:
services.flatpak.update.auto = {
enable = true;
onCalendar = "weekly"; # Default value
};