2017-12-31 04:10:15 +00:00
|
|
|
# flatpak service.
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2018-02-13 01:09:51 +00:00
|
|
|
let
|
|
|
|
cfg = config.services.flatpak;
|
|
|
|
in {
|
2018-05-11 04:00:44 +00:00
|
|
|
meta = {
|
2023-01-24 23:33:40 +00:00
|
|
|
doc = ./flatpak.md;
|
2018-05-11 04:00:44 +00:00
|
|
|
maintainers = pkgs.flatpak.meta.maintainers;
|
|
|
|
};
|
|
|
|
|
2017-12-31 04:10:15 +00:00
|
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
services.flatpak = {
|
|
|
|
enable = mkEnableOption (lib.mdDoc "flatpak");
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
2018-02-13 01:09:51 +00:00
|
|
|
config = mkIf cfg.enable {
|
2019-07-10 14:01:25 +00:00
|
|
|
|
2019-07-27 02:35:50 +00:00
|
|
|
assertions = [
|
|
|
|
{ assertion = (config.xdg.portal.enable == true);
|
|
|
|
message = "To use Flatpak you must enable XDG Desktop Portals with xdg.portal.enable.";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2021-05-18 11:53:10 +00:00
|
|
|
environment.systemPackages = [ pkgs.flatpak ];
|
2017-12-31 04:10:15 +00:00
|
|
|
|
2022-03-05 12:57:30 +00:00
|
|
|
security.polkit.enable = true;
|
|
|
|
|
2023-10-21 04:56:21 +00:00
|
|
|
fonts.fontDir.enable = true;
|
|
|
|
|
2019-07-10 14:01:25 +00:00
|
|
|
services.dbus.packages = [ pkgs.flatpak ];
|
2018-02-13 01:09:51 +00:00
|
|
|
|
2019-07-10 14:01:25 +00:00
|
|
|
systemd.packages = [ pkgs.flatpak ];
|
2023-12-10 05:38:18 +00:00
|
|
|
systemd.tmpfiles.packages = [ pkgs.flatpak ];
|
2017-12-31 04:10:15 +00:00
|
|
|
|
2018-05-21 11:42:51 +00:00
|
|
|
environment.profiles = [
|
|
|
|
"$HOME/.local/share/flatpak/exports"
|
|
|
|
"/var/lib/flatpak/exports"
|
|
|
|
];
|
2019-07-22 19:35:46 +00:00
|
|
|
|
2019-07-31 03:01:08 +00:00
|
|
|
# It has been possible since https://github.com/flatpak/flatpak/releases/tag/1.3.2
|
|
|
|
# to build a SELinux policy module.
|
|
|
|
|
2020-07-24 07:04:16 +00:00
|
|
|
# TODO: use sysusers.d
|
2019-07-22 19:35:46 +00:00
|
|
|
users.users.flatpak = {
|
|
|
|
description = "Flatpak system helper";
|
|
|
|
group = "flatpak";
|
|
|
|
isSystemUser = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
users.groups.flatpak = { };
|
2017-12-31 04:10:15 +00:00
|
|
|
};
|
|
|
|
}
|