This commit is contained in:
DashieTM 2025-05-01 22:05:12 +02:00
parent 4a8e226066
commit c57a9984c1
8 changed files with 28 additions and 42 deletions

View file

@ -7,37 +7,15 @@
}: {
options.mods.flatpak = {
enable = lib.mkOption {
default = true;
example = false;
default = false;
example = true;
type = lib.types.bool;
description = "Enables the flatpak package manager";
};
additional_packages = lib.mkOption {
default = [];
example = [];
type = with lib.types; listOf str;
description = "Flatpak packages";
};
};
config = lib.mkIf config.mods.flatpak.enable (
lib.optionalAttrs (options ? services.flatpak.remote) {
lib.optionalAttrs (options ? environment.systemPackages) {
environment.systemPackages = [pkgs.flatpak];
services.flatpak.remotes = lib.mkOptionDefault [
{
name = "flathub-stable";
location = "https://dl.flathub.org/repo/flathub.flatpakrepo";
}
];
services.flatpak.uninstallUnmanaged = true;
}
// lib.optionalAttrs (options ? services.flatpak.packages) {
services.flatpak.packages =
[
# fallback if necessary, but generally avoided as nix is superior :)
# default flatseal installation since flatpak permissions are totally not a broken idea
"com.github.tchx84.Flatseal"
]
++ config.mods.flatpak.additional_packages;
}
);
}