0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-20 09:00:41 +03:00
nixpkgs/nixos/modules/config/xdg/portals/wlr.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
1.6 KiB
Nix
Raw Normal View History

2021-06-16 11:57:23 +02:00
{
config,
pkgs,
lib,
...
}:
let
cfg = config.xdg.portal.wlr;
package = pkgs.xdg-desktop-portal-wlr;
settingsFormat = pkgs.formats.ini { };
configFile = settingsFormat.generate "xdg-desktop-portal-wlr.ini" cfg.settings;
in
{
meta = {
maintainers = with lib.maintainers; [ minijackson ];
2021-06-16 11:57:23 +02:00
};
options.xdg.portal.wlr = {
enable = lib.mkEnableOption ''
desktop portal for wlroots-based desktops.
2021-06-16 11:57:23 +02:00
This will add the `xdg-desktop-portal-wlr` package into
2021-06-16 11:57:23 +02:00
the {option}`xdg.portal.extraPortals` option, and provide the
configuration file
'';
settings = lib.mkOption {
2021-06-16 11:57:23 +02:00
description = ''
Configuration for `xdg-desktop-portal-wlr`.
2021-06-16 11:57:23 +02:00
See `xdg-desktop-portal-wlr(5)` for supported
values.
'';
type = lib.types.submodule {
2021-06-16 11:57:23 +02:00
freeformType = settingsFormat.type;
};
default = { };
# Example taken from the manpage
example = lib.literalExpression ''
2021-06-16 11:57:23 +02:00
{
screencast = {
output_name = "HDMI-A-1";
max_fps = 30;
exec_before = "disable_notifications.sh";
exec_after = "enable_notifications.sh";
chooser_type = "simple";
chooser_cmd = "''${pkgs.slurp}/bin/slurp -f %o -or";
};
}
'';
};
};
config = lib.mkIf cfg.enable {
2021-06-16 11:57:23 +02:00
xdg.portal = {
enable = true;
extraPortals = [ package ];
};
systemd.user.services.xdg-desktop-portal-wlr.serviceConfig.ExecStart = [
# Empty ExecStart value to override the field
""
"${package}/libexec/xdg-desktop-portal-wlr --config=${configFile}"
];
};
}