Merge pull request #127085 from minijackson/xdg-desktop-portal-wlr-0.4.0-and-module

xdg-desktop-portal-wlr: 0.3.0 -> 0.4.0 and module
This commit is contained in:
Jan Tojnar 2021-06-25 03:50:44 +02:00 committed by GitHub
commit 27bbb94761
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 82 additions and 4 deletions

View file

@ -20,4 +20,14 @@
essential utilities. Now you can start <package>sway</package> from the TTY
console.
</para>
<para>
If you are using a wlroots-based compositor, like sway, and want to be able to
share your screen, you might want to activate this option:
<programlisting>
<xref linkend="opt-xdg.portal.wlr.enable"/> = true;
</programlisting>
and configure Pipewire using <xref linkend="opt-services.pipewire.enable"/>
and related options.
</para>
</chapter>

View file

@ -0,0 +1,67 @@
{ config, pkgs, lib, ... }:
with 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 maintainers; [ minijackson ];
};
options.xdg.portal.wlr = {
enable = mkEnableOption ''
desktop portal for wlroots-based desktops
This will add the <package>xdg-desktop-portal-wlr</package> package into
the <option>xdg.portal.extraPortals</option> option, and provide the
configuration file
'';
settings = mkOption {
description = ''
Configuration for <package>xdg-desktop-portal-wlr</package>.
See <literal>xdg-desktop-portal-wlr(5)</literal> for supported
values.
'';
type = types.submodule {
freeformType = settingsFormat.type;
};
default = { };
# Example taken from the manpage
example = literalExample ''
{
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 = mkIf cfg.enable {
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}"
];
};
}

View file

@ -9,6 +9,7 @@
./config/xdg/menus.nix
./config/xdg/mime.nix
./config/xdg/portal.nix
./config/xdg/portals/wlr.nix
./config/appstream.nix
./config/console.nix
./config/xdg/sounds.nix

View file

@ -1,20 +1,20 @@
{ lib, stdenv, fetchFromGitHub, makeWrapper
, meson, ninja, pkg-config, wayland-protocols
, pipewire, wayland, systemd, libdrm, iniparser, scdoc, grim, slurp }:
, pipewire, wayland, systemd, libdrm, inih, scdoc, grim, slurp }:
stdenv.mkDerivation rec {
pname = "xdg-desktop-portal-wlr";
version = "0.3.0";
version = "0.4.0";
src = fetchFromGitHub {
owner = "emersion";
repo = pname;
rev = "v${version}";
sha256 = "sha256-6ArUQfWx5rNdpsd8Q22MqlpxLT8GTSsymAf21zGe1KI=";
sha256 = "sha256:13fbzh8bjnhk4xs8j9bpc01q3hy27zpbf0gkk1fnh3hm5pnyfyiv";
};
nativeBuildInputs = [ meson ninja pkg-config wayland-protocols makeWrapper ];
buildInputs = [ pipewire wayland systemd libdrm iniparser scdoc ];
buildInputs = [ pipewire wayland systemd libdrm inih scdoc ];
mesonFlags = [
"-Dsd-bus-provider=libsystemd"