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 05:00:44 +01:00
|
|
|
meta = {
|
|
|
|
doc = ./flatpak.xml;
|
|
|
|
maintainers = pkgs.flatpak.meta.maintainers;
|
|
|
|
};
|
|
|
|
|
2017-12-31 04:10:15 +00:00
|
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
services.flatpak = {
|
|
|
|
enable = mkEnableOption "flatpak";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
2018-02-13 01:09:51 +00:00
|
|
|
config = mkIf cfg.enable {
|
2019-07-10 15:01:25 +01:00
|
|
|
|
2019-07-27 03:35:50 +01:00
|
|
|
assertions = [
|
|
|
|
{ assertion = (config.xdg.portal.enable == true);
|
|
|
|
message = "To use Flatpak you must enable XDG Desktop Portals with xdg.portal.enable.";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2017-12-31 04:10:15 +00:00
|
|
|
environment.systemPackages = [ pkgs.flatpak ];
|
|
|
|
|
2019-07-10 15:01:25 +01:00
|
|
|
services.dbus.packages = [ pkgs.flatpak ];
|
2018-02-13 01:09:51 +00:00
|
|
|
|
2019-07-10 15:01:25 +01:00
|
|
|
systemd.packages = [ pkgs.flatpak ];
|
2017-12-31 04:10:15 +00:00
|
|
|
|
2018-05-21 12:42:51 +01:00
|
|
|
environment.profiles = [
|
|
|
|
"$HOME/.local/share/flatpak/exports"
|
|
|
|
"/var/lib/flatpak/exports"
|
|
|
|
];
|
2019-07-22 20:35:46 +01:00
|
|
|
|
2019-07-31 04:01:08 +01: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 08:04:16 +01:00
|
|
|
# TODO: use sysusers.d
|
2019-07-22 20:35:46 +01:00
|
|
|
users.users.flatpak = {
|
|
|
|
description = "Flatpak system helper";
|
|
|
|
group = "flatpak";
|
|
|
|
isSystemUser = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
users.groups.flatpak = { };
|
2017-12-31 04:10:15 +00:00
|
|
|
};
|
|
|
|
}
|