From d5cdbb7b326d16d7e1a56b07c7e4e494ea3906c7 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Wed, 16 Jun 2021 11:50:49 +0200 Subject: [PATCH 1/3] xdg-desktop-portal-wlr: 0.3.0 -> 0.4.0 --- .../libraries/xdg-desktop-portal-wlr/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/xdg-desktop-portal-wlr/default.nix b/pkgs/development/libraries/xdg-desktop-portal-wlr/default.nix index 3739284d70ac..4f842e5de186 100644 --- a/pkgs/development/libraries/xdg-desktop-portal-wlr/default.nix +++ b/pkgs/development/libraries/xdg-desktop-portal-wlr/default.nix @@ -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" From f4dd218c7c751931b2eca6927158d44c92baa595 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Wed, 16 Jun 2021 11:57:23 +0200 Subject: [PATCH 2/3] nixos/xdg/portal/wlr: init --- nixos/modules/config/xdg/portals/wlr.nix | 67 ++++++++++++++++++++++++ nixos/modules/module-list.nix | 1 + 2 files changed, 68 insertions(+) create mode 100644 nixos/modules/config/xdg/portals/wlr.nix diff --git a/nixos/modules/config/xdg/portals/wlr.nix b/nixos/modules/config/xdg/portals/wlr.nix new file mode 100644 index 000000000000..55baab0026b2 --- /dev/null +++ b/nixos/modules/config/xdg/portals/wlr.nix @@ -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 xdg-desktop-portal-wlr package into + the option, and provide the + configuration file + ''; + + settings = mkOption { + description = '' + Configuration for xdg-desktop-portal-wlr. + + See xdg-desktop-portal-wlr(5) 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}" + ]; + }; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 1a4c2fb719dc..8a96b42c556b 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -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 From ab15091abeb4da09df74503a12dc80774958f3b7 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Thu, 17 Jun 2021 10:36:21 +0200 Subject: [PATCH 3/3] nixos/manual: mention xdg.portal.wlr module in Wayland --- nixos/doc/manual/configuration/wayland.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nixos/doc/manual/configuration/wayland.xml b/nixos/doc/manual/configuration/wayland.xml index 231c219cf081..2aefda3e22c0 100644 --- a/nixos/doc/manual/configuration/wayland.xml +++ b/nixos/doc/manual/configuration/wayland.xml @@ -20,4 +20,14 @@ essential utilities. Now you can start sway from the TTY console. + + + 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: + + = true; + + and configure Pipewire using + and related options. +