1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-08 20:29:43 +01:00
home-manager/tests/modules/misc/xdg/portal.nix
2024-01-03 20:51:54 +01:00

37 lines
1.4 KiB
Nix

{ config, lib, pkgs, ... }:
lib.mkIf config.test.enableBig {
xdg.portal = {
enable = true;
extraPortals =
[ pkgs.xdg-desktop-portal-hyprland pkgs.xdg-desktop-portal-wlr ];
configPackages = [ pkgs.hyprland ];
config = { sway.default = [ "wlr" "gtk" ]; };
};
nmt.script = ''
xdgDesktopPortal=home-files/.config/systemd/user/xdg-desktop-portal.service
assertFileExists $xdgDesktopPortal
xdgDesktopPortalWlr=home-path/share/systemd/user/xdg-desktop-portal-wlr.service
assertFileExists $xdgDesktopPortalWlr
xdgDesktopPortalHyprland=home-path/share/systemd/user/xdg-desktop-portal-hyprland.service
assertFileExists $xdgDesktopPortalHyprland
portalsDir="$(cat $TESTED/$xdgDesktopPortal | grep Environment=XDG_DESKTOP_PORTAL_DIR | cut -d '=' -f3)"
portalConfigsDir="$(cat $TESTED/$xdgDesktopPortal | grep Environment=NIXOS_XDG_DESKTOP_PORTAL_CONFIG_DIR | cut -d '=' -f3)"
assertFileContent $portalsDir/hyprland.portal \
${pkgs.xdg-desktop-portal-hyprland}/share/xdg-desktop-portal/portals/hyprland.portal
assertFileContent $portalsDir/wlr.portal \
${pkgs.xdg-desktop-portal-wlr}/share/xdg-desktop-portal/portals/wlr.portal
assertFileContent $portalConfigsDir/hyprland-portals.conf \
${pkgs.hyprland}/share/xdg-desktop-portal/hyprland-portals.conf
assertFileContent $portalConfigsDir/sway-portals.conf \
${./sway-portals-expected.conf}
'';
}