nixpkgs-suyu/nixos/modules/services/desktops/flatpak.nix

53 lines
1.4 KiB
Nix
Raw Normal View History

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