diff options
author | Tor Hedin Brønner <torhedinbronner@gmail.com> | 2018-12-10 16:53:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-10 16:53:27 +0100 |
commit | 59d1fb61513b32ef5a6ea6a9edfc8111122ebe54 (patch) | |
tree | 64dc25635d2dfb674dabfc756c28b0c635370bb9 /nixos | |
parent | 655231a612cf550c0556f6fa6bd705c9daba7d6c (diff) | |
parent | 75e223bf7ac358bcf4320bb80b386d7cfddc90d1 (diff) | |
download | nixlib-59d1fb61513b32ef5a6ea6a9edfc8111122ebe54.tar nixlib-59d1fb61513b32ef5a6ea6a9edfc8111122ebe54.tar.gz nixlib-59d1fb61513b32ef5a6ea6a9edfc8111122ebe54.tar.bz2 nixlib-59d1fb61513b32ef5a6ea6a9edfc8111122ebe54.tar.lz nixlib-59d1fb61513b32ef5a6ea6a9edfc8111122ebe54.tar.xz nixlib-59d1fb61513b32ef5a6ea6a9edfc8111122ebe54.tar.zst nixlib-59d1fb61513b32ef5a6ea6a9edfc8111122ebe54.zip |
Merge pull request #44497 from hedning/gnome-upstream-wayland
Add gnome wayland support
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/x11/desktop-managers/gnome3.nix | 24 | ||||
-rw-r--r-- | nixos/modules/services/x11/display-managers/default.nix | 13 | ||||
-rw-r--r-- | nixos/modules/services/x11/display-managers/sddm.nix | 1 | ||||
-rw-r--r-- | nixos/tests/gnome3-gdm.nix | 32 | ||||
-rw-r--r-- | nixos/tests/gnome3.nix | 2 |
5 files changed, 47 insertions, 25 deletions
diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index 72109cf31af3..ba6d333b534e 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -136,19 +136,17 @@ in { services.xserver.displayManager.extraSessionFilePackages = [ pkgs.gnome3.gnome-session ]; - services.xserver.displayManager.sessionCommands = '' - if test "$XDG_CURRENT_DESKTOP" = "GNOME"; then - ${concatMapStrings (p: '' - if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then - export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name} - fi - - if [ -d "${p}/lib/girepository-1.0" ]; then - export GI_TYPELIB_PATH=$GI_TYPELIB_PATH''${GI_TYPELIB_PATH:+:}${p}/lib/girepository-1.0 - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib - fi - '') cfg.sessionPath} - fi + environment.extraInit = '' + ${concatMapStrings (p: '' + if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then + export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name} + fi + + if [ -d "${p}/lib/girepository-1.0" ]; then + export GI_TYPELIB_PATH=$GI_TYPELIB_PATH''${GI_TYPELIB_PATH:+:}${p}/lib/girepository-1.0 + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib + fi + '') cfg.sessionPath} ''; environment.variables.GNOME_SESSION_DEBUG = optionalString cfg.debug "1"; diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix index 26b79730dd38..035029150c81 100644 --- a/nixos/modules/services/x11/display-managers/default.nix +++ b/nixos/modules/services/x11/display-managers/default.nix @@ -78,8 +78,7 @@ let # This is required by user units using the session bus. ${config.systemd.package}/bin/systemctl --user import-environment DISPLAY XAUTHORITY DBUS_SESSION_BUS_ADDRESS - # Load X defaults. - # FIXME: Check XDG_SESSION_TYPE against x11 + # Load X defaults. This should probably be safe on wayland too. ${xorg.xrdb}/bin/xrdb -merge ${xresourcesXft} if test -e ~/.Xresources; then ${xorg.xrdb}/bin/xrdb -merge ~/.Xresources @@ -194,6 +193,11 @@ let ${concatMapStrings (pkg: '' ${xorg.lndir}/bin/lndir ${pkg}/share/xsessions $out/share/xsessions '') cfg.displayManager.extraSessionFilePackages} + + mkdir -p "$out/share/wayland-sessions" + ${concatMapStrings (pkg: '' + ${xorg.lndir}/bin/lndir ${pkg}/share/wayland-sessions $out/share/wayland-sessions + '') cfg.displayManager.extraSessionFilePackages} ''; in @@ -240,7 +244,10 @@ in '' xmessage "Hello World!" & ''; - description = "Shell commands executed just before the window or desktop manager is started."; + description = '' + Shell commands executed just before the window or desktop manager is + started. These commands are not currently sourced for Wayland sessions. + ''; }; hiddenUsers = mkOption { diff --git a/nixos/modules/services/x11/display-managers/sddm.nix b/nixos/modules/services/x11/display-managers/sddm.nix index b7511dfd5a8b..d5f98874b6ed 100644 --- a/nixos/modules/services/x11/display-managers/sddm.nix +++ b/nixos/modules/services/x11/display-managers/sddm.nix @@ -59,6 +59,7 @@ let [Wayland] EnableHidpi=${if cfg.enableHidpi then "true" else "false"} + SessionDir=${dmcfg.session.desktops}/share/wayland-sessions ${optionalString cfg.autoLogin.enable '' [Autologin] diff --git a/nixos/tests/gnome3-gdm.nix b/nixos/tests/gnome3-gdm.nix index 959030d59880..c2808d87d99d 100644 --- a/nixos/tests/gnome3-gdm.nix +++ b/nixos/tests/gnome3-gdm.nix @@ -23,11 +23,21 @@ import ./make-test.nix ({ pkgs, ...} : { virtualisation.memorySize = 1024; }; - testScript = - '' - # wait for gdm to start and bring up X + testScript = let + # Keep line widths somewhat managable + bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus"; + gdbus = "${bus} gdbus"; + # Call javascript in gnome shell, returns a tuple (success, output), where + # `success` is true if the dbus call was successful and output is what the + # javascript evaluates to. + eval = "call --session -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval"; + # False when startup is done + startingUp = "${gdbus} ${eval} Main.layoutManager._startingUp"; + # Hopefully gnome-terminal's wm class + wmClass = "${gdbus} ${eval} global.display.focus_window.wm_class"; + in '' + # wait for gdm to start $machine->waitForUnit("display-manager.service"); - $machine->waitForX; # wait for alice to be logged in $machine->waitForUnit("default.target","alice"); @@ -35,10 +45,16 @@ import ./make-test.nix ({ pkgs, ...} : { # Check that logging in has given the user ownership of devices. $machine->succeed("getfacl /dev/snd/timer | grep -q alice"); - # open a terminal and check it's there - $machine->succeed("su - alice -c 'DISPLAY=:0.0 XAUTHORITY=/run/user/\$UID/gdm/Xauthority gnome-terminal'"); - $machine->succeed("xauth merge /run/user/1000/gdm/Xauthority"); - $machine->waitForWindow(qr/Terminal/); + # Wait for the wayland server + $machine->waitForFile("/run/user/1000/wayland-0"); + + # Wait for gnome shell, correct output should be "(true, 'false')" + $machine->waitUntilSucceeds("su - alice -c '${startingUp} | grep -q true,..false'"); + + # open a terminal + $machine->succeed("su - alice -c '${bus} gnome-terminal'"); + # and check it's there + $machine->waitUntilSucceeds("su - alice -c '${wmClass} | grep -q gnome-terminal-server'"); # wait to get a nice screenshot $machine->sleep(20); diff --git a/nixos/tests/gnome3.nix b/nixos/tests/gnome3.nix index 6e92079f65a7..95694ea4828d 100644 --- a/nixos/tests/gnome3.nix +++ b/nixos/tests/gnome3.nix @@ -16,7 +16,7 @@ import ./make-test.nix ({ pkgs, ...} : { services.xserver.displayManager.lightdm.autoLogin.enable = true; services.xserver.displayManager.lightdm.autoLogin.user = "alice"; services.xserver.desktopManager.gnome3.enable = true; - services.xserver.desktopManager.default = "gnome"; + services.xserver.desktopManager.default = "gnome-xorg"; virtualisation.memorySize = 1024; }; |