nixos/flatpak: allow specifying extra portals

This commit is contained in:
Jan Tojnar
2018-02-13 02:09:51 +01:00
parent 843bc0f73a
commit ec80c5e4c4
4 changed files with 108 additions and 8 deletions

View File

@@ -3,26 +3,45 @@
with lib;
{
let
cfg = config.services.flatpak;
in {
###### 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.
'';
};
};
};
###### implementation
config = mkIf config.services.flatpak.enable {
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.flatpak ];
services.dbus.packages = [ pkgs.flatpak ];
services.dbus.packages = [ pkgs.flatpak pkgs.xdg-desktop-portal ] ++ cfg.extraPortals;
systemd.packages = [ pkgs.flatpak ];
systemd.packages = [ pkgs.flatpak pkgs.xdg-desktop-portal ] ++ cfg.extraPortals;
environment.variables.PATH = [
"$HOME/.local/share/flatpak/exports/bin"
"/var/lib/flatpak/exports/bin"
];
environment.variables = {
PATH = [
"$HOME/.local/share/flatpak/exports/bin"
"/var/lib/flatpak/exports/bin"
];
XDG_DESKTOP_PORTAL_PATH = map (p: "${p}/share/xdg-desktop-portal/portals") cfg.extraPortals;
};
};
}

View File

@@ -120,6 +120,7 @@ in {
services.xserver.libinput.enable = mkDefault true; # for controlling touchpad settings via gnome control center
services.udev.packages = [ pkgs.gnome3.gnome-settings-daemon ];
systemd.packages = [ pkgs.gnome3.vino ];
services.flatpak.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
# If gnome3 is installed, build vim for gtk3 too.
nixpkgs.config.vim.gui = "gtk3";