1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 03:30:45 +00:00

nixos/xdg: add portal option

This factors the configuration out of the flatpak module.
This commit is contained in:
Pasquale 2019-07-10 16:01:25 +02:00 committed by worldofpeace
parent 2ce67ce183
commit 90b1197301
6 changed files with 46 additions and 20 deletions

View file

@ -0,0 +1,38 @@
{ config, pkgs ,lib ,... }:
with lib;
{
options.xdg.portal = {
enable =
mkEnableOption "<link xlink:href='https://github.com/flatpak/xdg-desktop-portal'>xdg desktop integration</link>"//{
default = true;
};
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 and KDE already
adds <package>xdg-desktop-portal-gtk</package>; and
<package>xdg-desktop-portal-kde</package> respectively. On other desktop
environments you probably want to add them yourself.
'';
};
};
config =
let
cfg = config.xdg.portal;
packages = [ pkgs.xdg-desktop-portal ] ++ cfg.extraPortals;
in mkIf cfg.enable {
services.dbus.packages = packages;
systemd.packages = packages;
environment.variables = {
GTK_USE_PORTAL = "1";
XDG_DESKTOP_PORTAL_PATH = map (p: "${p}/share/xdg-desktop-portal/portals") cfg.extraPortals;
};
};
}

View file

@ -11,6 +11,7 @@
./config/xdg/icons.nix ./config/xdg/icons.nix
./config/xdg/menus.nix ./config/xdg/menus.nix
./config/xdg/mime.nix ./config/xdg/mime.nix
./config/xdg/portal.nix
./config/appstream.nix ./config/appstream.nix
./config/xdg/sounds.nix ./config/xdg/sounds.nix
./config/gtk/gtk-icon-cache.nix ./config/gtk/gtk-icon-cache.nix

View file

@ -19,6 +19,7 @@ with lib;
let value = getAttrFromPath [ "services" "ddclient" "domain" ] config; let value = getAttrFromPath [ "services" "ddclient" "domain" ] config;
in if value != "" then [ value ] else [])) in if value != "" then [ value ] else []))
(mkRemovedOptionModule [ "services" "ddclient" "homeDir" ] "") (mkRemovedOptionModule [ "services" "ddclient" "homeDir" ] "")
(mkRenamedOptionModule [ "services" "flatpak" "extraPortals" ] [ "xdg" "portal" "extraPortals" ])
(mkRenamedOptionModule [ "services" "i2pd" "extIp" ] [ "services" "i2pd" "address" ]) (mkRenamedOptionModule [ "services" "i2pd" "extIp" ] [ "services" "i2pd" "address" ])
(mkRenamedOptionModule [ "services" "kubernetes" "apiserver" "admissionControl" ] [ "services" "kubernetes" "apiserver" "enableAdmissionPlugins" ]) (mkRenamedOptionModule [ "services" "kubernetes" "apiserver" "admissionControl" ] [ "services" "kubernetes" "apiserver" "enableAdmissionPlugins" ])
(mkRenamedOptionModule [ "services" "kubernetes" "apiserver" "address" ] ["services" "kubernetes" "apiserver" "bindAddress"]) (mkRenamedOptionModule [ "services" "kubernetes" "apiserver" "address" ] ["services" "kubernetes" "apiserver" "bindAddress"])

View file

@ -15,38 +15,22 @@ in {
options = { options = {
services.flatpak = { services.flatpak = {
enable = mkEnableOption "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 ###### implementation
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.flatpak ]; environment.systemPackages = [ pkgs.flatpak ];
services.dbus.packages = [ pkgs.flatpak pkgs.xdg-desktop-portal ] ++ cfg.extraPortals; services.dbus.packages = [ pkgs.flatpak ];
systemd.packages = [ pkgs.flatpak pkgs.xdg-desktop-portal ] ++ cfg.extraPortals; systemd.packages = [ pkgs.flatpak ];
environment.profiles = [ environment.profiles = [
"$HOME/.local/share/flatpak/exports" "$HOME/.local/share/flatpak/exports"
"/var/lib/flatpak/exports" "/var/lib/flatpak/exports"
]; ];
environment.variables = {
XDG_DESKTOP_PORTAL_PATH = map (p: "${p}/share/xdg-desktop-portal/portals") cfg.extraPortals;
};
}; };
} }

View file

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

View file

@ -224,6 +224,8 @@ in
security.pam.services.sddm.enableKwallet = true; security.pam.services.sddm.enableKwallet = true;
security.pam.services.slim.enableKwallet = true; security.pam.services.slim.enableKwallet = true;
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-kde ];
# Update the start menu for each user that is currently logged in # Update the start menu for each user that is currently logged in
system.userActivationScripts.plasmaSetup = '' system.userActivationScripts.plasmaSetup = ''
# The KDE icon cache is supposed to update itself # The KDE icon cache is supposed to update itself