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 = {
|
|
|
|
enable = mkEnableOption "flatpak";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### 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.";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2017-12-31 05:10:15 +01:00
|
|
|
environment.systemPackages = [ pkgs.flatpak ];
|
|
|
|
|
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.
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|