git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #147557 from wmertens/nixos-ozone

wayland: enable ozone via $NIXOS_OZONE_WL

commitecd6b2864c2cd3916c50bd6563491b93f36da161 authorWout Mertens <Wout.Mertens@gmail.com> dateThu 27 Jan 2022, 23:46 (5 years ago) parentd9e21f2b2eb5f6
12 files changed+67−38
nixos/doc/manual/from_md/release-notes/rl-2205.section.xml+13 nixos/doc/manual/release-notes/rl-2205.section.md+13−4 nixos/tests/vscodium.nix+4−5 pkgs/applications/editors/vscode/generic.nix+1 pkgs/applications/networking/browsers/chromium/default.nix+2−1 pkgs/applications/networking/browsers/google-chrome/default.nix+3−2 pkgs/applications/networking/instant-messengers/discord/linux.nix+1 pkgs/applications/networking/instant-messengers/element/element-desktop.nix+2−3 pkgs/applications/networking/instant-messengers/schildichat/schildichat-desktop.nix+16−15 pkgs/applications/networking/instant-messengers/signal-desktop/default.nix+1 pkgs/applications/networking/instant-messengers/slack/default.nix+3−2 pkgs/top-level/all-packages.nix+8−6
nixos/doc/manual/from_md/release-notes/rl-2205.section.xml+13
@@ -600,6 +600,19 @@
600600 using the PyPy interpreter were added.
601601 </para>
602602 </listitem>
603+ <listitem>
604+ <para>
605+ If you are using Wayland you can choose to use the Ozone
606+ Wayland support in Chrome and several Electron apps by setting
607+ the environment variable <literal>NIXOS_OZONE_WL=1</literal>
608+ (for example via
609+ <literal>environment.sessionVariables.NIXOS_OZONE_WL = &quot;1&quot;</literal>).
610+ This is not enabled by default because Ozone Wayland is still
611+ under heavy development and behavior is not always flawless.
612+ Furthermore, not all Electron apps use the latest Electron
613+ versions.
614+ </para>
615+ </listitem>
603616 <listitem>
604617 <para>
605618 The <literal>influxdb2</literal> package was split into
nixos/doc/manual/release-notes/rl-2205.section.md+13−4
@@ -60,7 +60,7 @@ In addition to numerous new and upgraded packages, this release has the followin
6060## Backward Incompatibilities {#sec-release-22.05-incompatibilities}
6161
6262- `pkgs.ghc` now refers to `pkgs.targetPackages.haskellPackages.ghc`.
63− This *only* makes a difference if you are cross-compiling and will
63+ This _only_ makes a difference if you are cross-compiling and will
6464 ensure that `pkgs.ghc` always runs on the host platform and compiles
6565 for the target platform (similar to `pkgs.gcc` for example).
6666 `haskellPackages.ghc` still behaves as before, running on the build
@@ -181,7 +181,7 @@ In addition to numerous new and upgraded packages, this release has the followin
181181 to allow users to make changes to the `nixos-rebuild build-vm` configuration
182182 that do not apply to their normal system.
183183
184− The `config.system.build.vm` attribute now always exists and defaults to the
184+ The `config.system.build.vm` attribute now always exists and defaults to the
185185 value from `vmVariant`. Configurations that import the `virtualisation/qemu-vm.nix`
186186 module themselves will override this value, such that `vmVariant` is not used.
187187
@@ -193,6 +193,14 @@ In addition to numerous new and upgraded packages, this release has the followin
193193
194194- The `writers.writePyPy2`/`writers.writePyPy3` and corresponding `writers.writePyPy2Bin`/`writers.writePyPy3Bin` convenience functions to create executable Python 2/3 scripts using the PyPy interpreter were added.
195195
196+- If you are using Wayland you can choose to use the Ozone Wayland support
197+ in Chrome and several Electron apps by setting the environment variable
198+ `NIXOS_OZONE_WL=1` (for example via
199+ `environment.sessionVariables.NIXOS_OZONE_WL = "1"`).
200+ This is not enabled by default because Ozone Wayland is
201+ still under heavy development and behavior is not always flawless.
202+ Furthermore, not all Electron apps use the latest Electron versions.
203+
196204- The `influxdb2` package was split into `influxdb2-server` and
197205 `influxdb2-cli`, matching the split that took place upstream. A
198206 combined `influxdb2` package is still provided in this release for
@@ -244,8 +252,9 @@ In addition to numerous new and upgraded packages, this release has the followin
244252 Plugins are automatically repackaged using autoPatchelf.
245253
246254- The `zrepl` package has been updated from 0.4.0 to 0.5:
247− * The RPC protocol version was bumped; all zrepl daemons in a setup must be updated and restarted before replication can resume.
248− * A bug involving encrypt-on-receive has been fixed. Read the [zrepl documentation](https://zrepl.github.io/configuration/sendrecvoptions.html#job-recv-options-placeholder) and check the output of `zfs get -r encryption,zrepl:placeholder PATH_TO_ROOTFS` on the receiver.
255+
256+ - The RPC protocol version was bumped; all zrepl daemons in a setup must be updated and restarted before replication can resume.
257+ - A bug involving encrypt-on-receive has been fixed. Read the [zrepl documentation](https://zrepl.github.io/configuration/sendrecvoptions.html#job-recv-options-placeholder) and check the output of `zfs get -r encryption,zrepl:placeholder PATH_TO_ROOTFS` on the receiver.
249258
250259- Renamed option `services.openssh.challengeResponseAuthentication` to `services.openssh.kbdInteractiveAuthentication`.
251260 Reason is that the old name has been deprecated upstream.
nixos/tests/vscodium.nix+4−5
@@ -3,11 +3,10 @@ let
33 wayland = { pkgs, ... }: {
44 imports = [ ./common/wayland-cage.nix ];
55
6− services.cage.program = ''
7− ${pkgs.vscodium}/bin/codium \
8− --enable-features=UseOzonePlatform \
9− --ozone-platform=wayland
10− '';
6+ services.cage.program = "${pkgs.vscodium}/bin/codium";
7+
8+ environment.variables.NIXOS_OZONE_WL = "1";
9+ environment.variables.DISPLAY = "do not use";
1110
1211 fonts.fonts = with pkgs; [ dejavu_fonts ];
1312 };
pkgs/applications/editors/vscode/generic.nix+1
@@ -108,6 +108,7 @@ let
108108 gappsWrapperArgs+=(
109109 # Add gio to PATH so that moving files to the trash works when not using a desktop environment
110110 --prefix PATH : ${glib.bin}/bin
111+ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}"
111112 )
112113 '';
113114
pkgs/applications/networking/browsers/chromium/default.nix+2−1
@@ -183,7 +183,8 @@ in stdenv.mkDerivation {
183183 mkdir -p "$out/bin"
184184
185185 eval makeWrapper "${browserBinary}" "$out/bin/chromium" \
186− --add-flags ${escapeShellArg (escapeShellArg commandLineArgs)}
186+ --add-flags ${escapeShellArg (escapeShellArg commandLineArgs)} \
187+ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}"
187188
188189 ed -v -s "$out/bin/chromium" << EOF
189190 2i
pkgs/applications/networking/browsers/google-chrome/default.nix+3−2
@@ -142,8 +142,9 @@ in stdenv.mkDerivation {
142142 makeWrapper "$out/share/google/$appname/google-$appname" "$exe" \
143143 --prefix LD_LIBRARY_PATH : "$rpath" \
144144 --prefix PATH : "$binpath" \
145− --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH:${addOpenGLRunpath.driverLink}/share" \
146− --add-flags ${escapeShellArg commandLineArgs}
145+ --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" \
146+ --add-flags ${escapeShellArg commandLineArgs} \
147+ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}"
147148
148149 for elf in $out/share/google/$appname/{chrome,chrome-sandbox,${crashpadHandlerBinary},nacl_helper}; do
149150 patchelf --set-rpath $rpath $elf
pkgs/applications/networking/instant-messengers/discord/linux.nix+1
@@ -80,6 +80,7 @@ stdenv.mkDerivation rec {
8080
8181 wrapProgram $out/opt/${binaryName}/${binaryName} \
8282 "''${gappsWrapperArgs[@]}" \
83+ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}" \
8384 --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \
8485 --prefix LD_LIBRARY_PATH : ${libPath}:$out/opt/${binaryName}
8586
pkgs/applications/networking/instant-messengers/element/element-desktop.nix+2−3
@@ -12,8 +12,6 @@
1212, Security
1313, AppKit
1414, CoreServices
15−
16−, useWayland ? false
1715}:
1816
1917let
@@ -82,7 +80,8 @@ mkYarnPackage rec {
8280 # LD_PRELOAD workaround for sqlcipher not found: https://github.com/matrix-org/seshat/issues/102
8381 makeWrapper '${electron_exec}' "$out/bin/${executableName}" \
8482 --set LD_PRELOAD ${sqlcipher}/lib/libsqlcipher.so \
85− --add-flags "$out/share/element/electron${lib.optionalString useWayland " --enable-features=UseOzonePlatform --ozone-platform=wayland"}"
83+ --add-flags "$out/share/element/electron" \
84+ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}"
8685 '';
8786
8887 # Do not attempt generating a tarball for element-web again.
pkgs/applications/networking/instant-messengers/schildichat/schildichat-desktop.nix+16−15
@@ -7,13 +7,13 @@
77, makeDesktopItem
88, copyDesktopItems
99, fetchYarnDeps
10−, yarn, nodejs, fixup_yarn_lock
10+, yarn
11+, nodejs
12+, fixup_yarn_lock
1113, electron
1214, Security
1315, AppKit
1416, CoreServices
15−
16−, useWayland ? false
1717}:
1818
1919let
@@ -88,7 +88,8 @@ stdenv.mkDerivation rec {
8888
8989 # executable wrapper
9090 makeWrapper '${electron_exec}' "$out/bin/${executableName}" \
91− --add-flags "$out/share/element/electron${lib.optionalString useWayland " --enable-features=UseOzonePlatform --ozone-platform=wayland"}"
91+ --add-flags "$out/share/element/electron" \
92+ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}"
9293
9394 runHook postInstall
9495 '';
@@ -101,17 +102,17 @@ stdenv.mkDerivation rec {
101102 # https://github.com/schildichat/element-desktop/blob/sc/package.json
102103 desktopItems = [
103104 (makeDesktopItem {
104− name = "schildichat-desktop";
105− exec = "${executableName} %u";
106− icon = "schildichat";
107− desktopName = "SchildiChat";
108− genericName = "Matrix Client";
109− comment = meta.description;
110− categories = "Network;InstantMessaging;Chat;";
111− extraEntries = ''
112− StartupWMClass=schildichat
113− MimeType=x-scheme-handler/element;
114− '';
105+ name = "schildichat-desktop";
106+ exec = "${executableName} %u";
107+ icon = "schildichat";
108+ desktopName = "SchildiChat";
109+ genericName = "Matrix Client";
110+ comment = meta.description;
111+ categories = "Network;InstantMessaging;Chat;";
112+ extraEntries = ''
113+ StartupWMClass=schildichat
114+ MimeType=x-scheme-handler/element;
115+ '';
115116 })
116117 ];
117118
pkgs/applications/networking/instant-messengers/signal-desktop/default.nix+1
@@ -123,6 +123,7 @@ in stdenv.mkDerivation rec {
123123 gappsWrapperArgs+=(
124124 --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc ] }"
125125 ${customLanguageWrapperArgs}
126+ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}"
126127 )
127128
128129 # Fix the desktop link
pkgs/applications/networking/instant-messengers/slack/default.nix+3−2
@@ -84,7 +84,7 @@ let
8484 homepage = "https://slack.com";
8585 license = licenses.unfree;
8686 maintainers = with maintainers; [ mmahut ];
87− platforms = [ "x86_64-darwin" "x86_64-linux" "aarch64-darwin"];
87+ platforms = [ "x86_64-darwin" "x86_64-linux" "aarch64-darwin" ];
8888 };
8989
9090 linux = stdenv.mkDerivation rec {
@@ -170,7 +170,8 @@ let
170170 rm $out/bin/slack
171171 makeWrapper $out/lib/slack/slack $out/bin/slack \
172172 --prefix XDG_DATA_DIRS : $GSETTINGS_SCHEMAS_PATH \
173− --prefix PATH : ${lib.makeBinPath [xdg-utils]}
173+ --prefix PATH : ${lib.makeBinPath [xdg-utils]} \
174+ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}"
174175
175176 # Fix the desktop link
176177 substituteInPlace $out/share/applications/slack.desktop \
pkgs/top-level/all-packages.nix+8−6
@@ -2929,9 +2929,10 @@ with pkgs;
29292929 inherit (darwin.apple_sdk.frameworks) Security AppKit CoreServices;
29302930 electron = electron_13;
29312931 };
2932− element-desktop-wayland = element-desktop.override {
2933− useWayland = true;
2934− };
2932+ element-desktop-wayland = writeScript "element-desktop-wayland" ''
2933+ #!/bin/sh
2934+ NIXOS_OZONE_WL=1 exec ${element-desktop}/bin/element-desktop "$@"
2935+ '';
29352936
29362937 element-web = callPackage ../applications/networking/instant-messengers/element/element-web.nix {
29372938 conf = config.element-web.conf or {};
@@ -4923,9 +4924,10 @@ with pkgs;
49234924 inherit (darwin.apple_sdk.frameworks) Security AppKit CoreServices;
49244925 electron = electron_13;
49254926 };
4926− schildichat-desktop-wayland = schildichat-desktop.override {
4927− useWayland = true;
4928− };
4927+ schildichat-desktop-wayland = writeScript "schildichat-desktop-wayland" ''
4928+ #!/bin/sh
4929+ NIXOS_OZONE_WL=1 exec ${schildichat-desktop}/bin/schildichat-desktop "$@"
4930+ '';
49294931
49304932 schildichat-web = callPackage ../applications/networking/instant-messengers/schildichat/schildichat-web.nix {
49314933 conf = config.schildichat-web.conf or {};