diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2023-11-18 00:54:36 +0100 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2024-02-11 03:32:47 +0100 |
commit | fe40e99020f340c982e156e22ac531157174af5b (patch) | |
tree | 786869c369be8d02a36f49188ac825f0c7e88a26 | |
parent | 3b2f55e89f8233333b191bb7b4c9d6448a4a2d74 (diff) |
nixos/xdg/portal: Use systemPackage instead of buildEnv
Portals are global so we can just link them globally.
There might, in theory, be some unexpected system-path contamination
(e.g. when a portal package installs its executables to `/bin`)
but I think the risk is relatively minor compared to the added complexity.
While at it, let’s point the environment variable to system-path.
That will allow changes to installed portals to apply without having to re-log in.
-rw-r--r-- | nixos/modules/config/xdg/portal.nix | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/nixos/modules/config/xdg/portal.nix b/nixos/modules/config/xdg/portal.nix index a1540d86fa75..5aa23377f9ff 100644 --- a/nixos/modules/config/xdg/portal.nix +++ b/nixos/modules/config/xdg/portal.nix @@ -119,12 +119,6 @@ in let cfg = config.xdg.portal; packages = [ pkgs.xdg-desktop-portal ] ++ cfg.extraPortals; - - joinedPortals = pkgs.buildEnv { - name = "xdg-portals"; - paths = packages; - pathsToLink = [ "/share/xdg-desktop-portal/portals" "/share/applications" ]; - }; in mkIf cfg.enable { warnings = lib.optional (cfg.configPackages == [ ] && cfg.config == { }) '' @@ -151,11 +145,9 @@ in systemd.packages = packages; environment = { - systemPackages = [ - joinedPortals - ] ++ cfg.configPackages; + systemPackages = packages ++ cfg.configPackages; pathsToLink = [ - # Upstream desktop environment portal configurations. + # Portal definitions and upstream desktop environment portal configurations. "/share/xdg-desktop-portal" # .desktop files to register fallback icon and app name. "/share/applications" @@ -164,7 +156,7 @@ in sessionVariables = { GTK_USE_PORTAL = mkIf cfg.gtkUsePortal "1"; NIXOS_XDG_OPEN_USE_PORTAL = mkIf cfg.xdgOpenUsePortal "1"; - NIX_XDG_DESKTOP_PORTAL_DIR = "${joinedPortals}/share/xdg-desktop-portal/portals"; + NIX_XDG_DESKTOP_PORTAL_DIR = "/run/current-system/sw/share/xdg-desktop-portal/portals"; }; etc = lib.concatMapAttrs |