summary refs log tree commit diff
path: root/nixos/modules/services/x11/display-managers/gdm.nix
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2018-10-03 22:56:53 -0500
committerGitHub <noreply@github.com>2018-10-03 22:56:53 -0500
commit1ffe83caa7c521366780233f02c1ae092a20a782 (patch)
tree7e44c6431dada15cff84c2ae5b677802c55aac9e /nixos/modules/services/x11/display-managers/gdm.nix
parent06961cccd08bf99fe757ad7162086e37b5b28bda (diff)
parentf26153754a1b6ac0d72adde9c75e1473463b4dbb (diff)
downloadnixpkgs-1ffe83caa7c521366780233f02c1ae092a20a782.tar
nixpkgs-1ffe83caa7c521366780233f02c1ae092a20a782.tar.gz
nixpkgs-1ffe83caa7c521366780233f02c1ae092a20a782.tar.bz2
nixpkgs-1ffe83caa7c521366780233f02c1ae092a20a782.tar.lz
nixpkgs-1ffe83caa7c521366780233f02c1ae092a20a782.tar.xz
nixpkgs-1ffe83caa7c521366780233f02c1ae092a20a782.tar.zst
nixpkgs-1ffe83caa7c521366780233f02c1ae092a20a782.zip
Merge pull request #42846 from ambrop72/optimus-prime-config-master
nixos/xserver: Implement configuration of NVIDIA Optimus via PRIME
Diffstat (limited to 'nixos/modules/services/x11/display-managers/gdm.nix')
-rw-r--r--nixos/modules/services/x11/display-managers/gdm.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/nixos/modules/services/x11/display-managers/gdm.nix b/nixos/modules/services/x11/display-managers/gdm.nix
index a16cbee3bb3..6cc30b218f4 100644
--- a/nixos/modules/services/x11/display-managers/gdm.nix
+++ b/nixos/modules/services/x11/display-managers/gdm.nix
@@ -7,6 +7,13 @@ let
   cfg = config.services.xserver.displayManager;
   gdm = pkgs.gnome3.gdm;
 
+  xSessionWrapper = if (cfg.setupCommands == "") then null else
+    pkgs.writeScript "gdm-x-session-wrapper" ''
+      #!${pkgs.bash}/bin/bash
+      ${cfg.setupCommands}
+      exec "$@"
+    '';
+
 in
 
 {
@@ -112,6 +119,11 @@ in
           GDM_SESSIONS_DIR = "${cfg.session.desktops}/share/xsessions";
           # Find the mouse
           XCURSOR_PATH = "~/.icons:${pkgs.gnome3.adwaita-icon-theme}/share/icons";
+        } // optionalAttrs (xSessionWrapper != null) {
+          # Make GDM use this wrapper before running the session, which runs the
+          # configured setupCommands. This relies on a patched GDM which supports
+          # this environment variable.
+          GDM_X_SESSION_WRAPPER = "${xSessionWrapper}";
         };
         execCmd = "exec ${gdm}/bin/gdm";
       };