summary refs log tree commit diff
path: root/nixos/modules/services/x11/display-managers/sddm.nix
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@gmail.com>2015-12-12 11:31:26 -0600
committerThomas Tuegel <ttuegel@gmail.com>2015-12-12 11:31:26 -0600
commitb07fa98f82ac44801dc34b6b143048ee28f7e1a3 (patch)
tree523d9f80ae5045f61fdb4d2326f605d70201c5a6 /nixos/modules/services/x11/display-managers/sddm.nix
parentf7edf63b23e25305fbe6c77d75a87fba7891beb5 (diff)
downloadnixpkgs-b07fa98f82ac44801dc34b6b143048ee28f7e1a3.tar
nixpkgs-b07fa98f82ac44801dc34b6b143048ee28f7e1a3.tar.gz
nixpkgs-b07fa98f82ac44801dc34b6b143048ee28f7e1a3.tar.bz2
nixpkgs-b07fa98f82ac44801dc34b6b143048ee28f7e1a3.tar.lz
nixpkgs-b07fa98f82ac44801dc34b6b143048ee28f7e1a3.tar.xz
nixpkgs-b07fa98f82ac44801dc34b6b143048ee28f7e1a3.tar.zst
nixpkgs-b07fa98f82ac44801dc34b6b143048ee28f7e1a3.zip
nixos/sddm: add setupScript and stopScript options
These options allow setting the start and stop scripts for the display
manager. Making these configurable is necessary to allow some hardware
configurations. Upstream ships empty scripts by default, anyway.
Diffstat (limited to 'nixos/modules/services/x11/display-managers/sddm.nix')
-rw-r--r--nixos/modules/services/x11/display-managers/sddm.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/nixos/modules/services/x11/display-managers/sddm.nix b/nixos/modules/services/x11/display-managers/sddm.nix
index d156f692f26..50e6a85b4f2 100644
--- a/nixos/modules/services/x11/display-managers/sddm.nix
+++ b/nixos/modules/services/x11/display-managers/sddm.nix
@@ -17,6 +17,16 @@ let
     exec ${dmcfg.xserverBin} ${dmcfg.xserverArgs} "$@"
   '';
 
+  Xsetup = pkgs.writeScript "Xsetup" ''
+    #!/bin/sh
+    ${cfg.setupScript}
+  '';
+
+  Xstop = pkgs.writeScript "Xstop" ''
+    #!/bin/sh
+    ${cfg.stopScript}
+  '';
+
   cfgFile = pkgs.writeText "sddm.conf" ''
     [General]
     HaltCommand=${pkgs.systemd}/bin/systemctl poweroff
@@ -39,6 +49,8 @@ let
     SessionCommand=${dmcfg.session.script}
     SessionDir=${dmcfg.session.desktops}
     XauthPath=${pkgs.xorg.xauth}/bin/xauth
+    DisplayCommand=${Xsetup}
+    DisplayStopCommand=${Xstop}
 
     ${optionalString cfg.autoLogin.enable ''
     [Autologin]
@@ -98,6 +110,27 @@ in
         '';
       };
 
+      setupScript = mkOption {
+        type = types.str;
+        default = "";
+        example = ''
+          # workaround for using NVIDIA Optimus without Bumblebee
+          xrandr --setprovideroutputsource modesetting NVIDIA-0
+          xrandr --auto
+        '';
+        description = ''
+          A script to execute when starting the display server.
+        '';
+      };
+
+      stopScript = mkOption {
+        type = types.str;
+        default = "";
+        description = ''
+          A script to execute when stopping the display server.
+        '';
+      };
+
       autoLogin = mkOption {
         default = {};
         description = ''