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";
|
2018-02-13 02:09:51 +01: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 05:10:15 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
2018-02-13 02:09:51 +01:00
|
|
|
config = mkIf cfg.enable {
|
2017-12-31 05:10:15 +01:00
|
|
|
environment.systemPackages = [ pkgs.flatpak ];
|
|
|
|
|
2018-02-13 02:09:51 +01: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 05:10:15 +01:00
|
|
|
|
2018-02-13 02:09:51 +01:00
|
|
|
environment.variables = {
|
|
|
|
PATH = [
|
|
|
|
"$HOME/.local/share/flatpak/exports/bin"
|
|
|
|
"/var/lib/flatpak/exports/bin"
|
|
|
|
];
|
2017-12-31 05:10:15 +01:00
|
|
|
|
2018-02-13 02:09:51 +01:00
|
|
|
XDG_DESKTOP_PORTAL_PATH = map (p: "${p}/share/xdg-desktop-portal/portals") cfg.extraPortals;
|
|
|
|
};
|
2017-12-31 05:10:15 +01:00
|
|
|
};
|
|
|
|
}
|