2017-12-31 05:10:15 +01:00
|
|
|
# flatpak service.
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2018-02-13 02:09:51 +01:00
|
|
|
let
|
|
|
|
cfg = config.services.flatpak;
|
|
|
|
in {
|
2018-05-11 06:00:44 +02:00
|
|
|
meta = {
|
|
|
|
doc = ./flatpak.xml;
|
|
|
|
maintainers = pkgs.flatpak.meta.maintainers;
|
|
|
|
};
|
|
|
|
|
2017-12-31 05:10:15 +01:00
|
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
services.flatpak = {
|
2022-08-28 21:18:44 +02:00
|
|
|
enable = mkEnableOption (lib.mdDoc "flatpak");
|
2017-12-31 05:10:15 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
2018-02-13 02:09:51 +01:00
|
|
|
config = mkIf cfg.enable {
|
2019-07-10 16:01:25 +02:00
|
|
|
|
2019-07-27 04:35:50 +02: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 13:53:10 +02:00
|
|
|
environment.systemPackages = [ pkgs.flatpak ];
|
2017-12-31 05:10:15 +01:00
|
|
|
|
2022-03-05 13:57:30 +01:00
|
|
|
security.polkit.enable = true;
|
|
|
|
|
2019-07-10 16:01:25 +02:00
|
|
|
services.dbus.packages = [ pkgs.flatpak ];
|
2018-02-13 02:09:51 +01:00
|
|
|
|
2019-07-10 16:01:25 +02:00
|
|
|
systemd.packages = [ pkgs.flatpak ];
|
2017-12-31 05:10:15 +01:00
|
|
|
|
2018-05-21 13:42:51 +02:00
|
|
|
environment.profiles = [
|
|
|
|
"$HOME/.local/share/flatpak/exports"
|
|
|
|
"/var/lib/flatpak/exports"
|
|
|
|
];
|
2019-07-22 21:35:46 +02:00
|
|
|
|
2019-07-31 05:01:08 +02: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 09:04:16 +02:00
|
|
|
# TODO: use sysusers.d
|
2019-07-22 21:35:46 +02:00
|
|
|
users.users.flatpak = {
|
|
|
|
description = "Flatpak system helper";
|
|
|
|
group = "flatpak";
|
|
|
|
isSystemUser = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
users.groups.flatpak = { };
|
2017-12-31 05:10:15 +01:00
|
|
|
};
|
|
|
|
}
|