nixos/xdg: add portal option
This factors the configuration out of the flatpak module.
This commit is contained in:
parent
2ce67ce183
commit
90b1197301
38
nixos/modules/config/xdg/portal.nix
Normal file
38
nixos/modules/config/xdg/portal.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
@ -11,6 +11,7 @@
|
||||
./config/xdg/icons.nix
|
||||
./config/xdg/menus.nix
|
||||
./config/xdg/mime.nix
|
||||
./config/xdg/portal.nix
|
||||
./config/appstream.nix
|
||||
./config/xdg/sounds.nix
|
||||
./config/gtk/gtk-icon-cache.nix
|
||||
|
@ -19,6 +19,7 @@ with lib;
|
||||
let value = getAttrFromPath [ "services" "ddclient" "domain" ] config;
|
||||
in if value != "" then [ value ] else []))
|
||||
(mkRemovedOptionModule [ "services" "ddclient" "homeDir" ] "")
|
||||
(mkRenamedOptionModule [ "services" "flatpak" "extraPortals" ] [ "xdg" "portal" "extraPortals" ])
|
||||
(mkRenamedOptionModule [ "services" "i2pd" "extIp" ] [ "services" "i2pd" "address" ])
|
||||
(mkRenamedOptionModule [ "services" "kubernetes" "apiserver" "admissionControl" ] [ "services" "kubernetes" "apiserver" "enableAdmissionPlugins" ])
|
||||
(mkRenamedOptionModule [ "services" "kubernetes" "apiserver" "address" ] ["services" "kubernetes" "apiserver" "bindAddress"])
|
||||
|
@ -15,38 +15,22 @@ in {
|
||||
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 cfg.enable {
|
||||
|
||||
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 = [
|
||||
"$HOME/.local/share/flatpak/exports"
|
||||
"/var/lib/flatpak/exports"
|
||||
];
|
||||
|
||||
environment.variables = {
|
||||
XDG_DESKTOP_PORTAL_PATH = map (p: "${p}/share/xdg-desktop-portal/portals") cfg.extraPortals;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ in {
|
||||
services.hardware.bolt.enable = mkDefault true;
|
||||
services.xserver.libinput.enable = mkDefault true; # for controlling touchpad settings via gnome control center
|
||||
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.
|
||||
nixpkgs.config.vim.gui = "gtk3";
|
||||
|
@ -224,6 +224,8 @@ in
|
||||
security.pam.services.sddm.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
|
||||
system.userActivationScripts.plasmaSetup = ''
|
||||
# The KDE icon cache is supposed to update itself
|
||||
|
Loading…
Reference in New Issue
Block a user