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 = {
|
|
|
|
doc = ./flatpak.xml;
|
|
|
|
maintainers = pkgs.flatpak.meta.maintainers;
|
|
|
|
};
|
|
|
|
|
2017-12-31 04:10:15 +00:00
|
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
services.flatpak = {
|
|
|
|
enable = mkEnableOption "flatpak";
|
2018-02-13 01:09:51 +00:00
|
|
|
|
|
|
|
extraPortals = mkOption {
|
|
|
|
type = types.listOf types.package;
|
|
|
|
default = [];
|
|
|
|
description = ''
|
|
|
|
List of additional portals to add to path. Portals allow interaction
|
|
|
|
with system, like choosing files or taking screenshots. At minimum,
|
|
|
|
a desktop portal implementation should be listed. GNOME already
|
|
|
|
adds <package>xdg-desktop-portal-gtk</package>; for KDE, there
|
|
|
|
is <package>xdg-desktop-portal-kde</package>. Other desktop
|
|
|
|
environments will probably want to do the same.
|
|
|
|
'';
|
|
|
|
};
|
2017-12-31 04:10:15 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
2018-02-13 01:09:51 +00:00
|
|
|
config = mkIf cfg.enable {
|
2017-12-31 04:10:15 +00:00
|
|
|
environment.systemPackages = [ pkgs.flatpak ];
|
|
|
|
|
2018-02-13 01:09:51 +00:00
|
|
|
services.dbus.packages = [ pkgs.flatpak pkgs.xdg-desktop-portal ] ++ cfg.extraPortals;
|
|
|
|
|
|
|
|
systemd.packages = [ pkgs.flatpak pkgs.xdg-desktop-portal ] ++ cfg.extraPortals;
|
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"
|
|
|
|
];
|
2017-12-31 04:10:15 +00:00
|
|
|
|
2018-05-21 11:42:51 +00:00
|
|
|
environment.variables = {
|
2018-02-13 01:09:51 +00:00
|
|
|
XDG_DESKTOP_PORTAL_PATH = map (p: "${p}/share/xdg-desktop-portal/portals") cfg.extraPortals;
|
|
|
|
};
|
2017-12-31 04:10:15 +00:00
|
|
|
};
|
|
|
|
}
|