git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commitb07fa98f82ac44801dc34b6b143048ee28f7e1a3 authorThomas Tuegel <ttuegel@gmail.com> dateSat 12 Dec 2015, 11:31 (11 years ago) parentf7edf63
1 file changed+33
nixos/modules/services/x11/display-managers/sddm.nix+33
nixos/modules/services/x11/display-managers/sddm.nix+33
@@ -17,6 +17,16 @@ let
1717 exec ${dmcfg.xserverBin} ${dmcfg.xserverArgs} "$@"
1818 '';
1919
20+ Xsetup = pkgs.writeScript "Xsetup" ''
21+ #!/bin/sh
22+ ${cfg.setupScript}
23+ '';
24+
25+ Xstop = pkgs.writeScript "Xstop" ''
26+ #!/bin/sh
27+ ${cfg.stopScript}
28+ '';
29+
2030 cfgFile = pkgs.writeText "sddm.conf" ''
2131 [General]
2232 HaltCommand=${pkgs.systemd}/bin/systemctl poweroff
@@ -39,6 +49,8 @@ let
3949 SessionCommand=${dmcfg.session.script}
4050 SessionDir=${dmcfg.session.desktops}
4151 XauthPath=${pkgs.xorg.xauth}/bin/xauth
52+ DisplayCommand=${Xsetup}
53+ DisplayStopCommand=${Xstop}
4254
4355 ${optionalString cfg.autoLogin.enable ''
4456 [Autologin]
@@ -98,6 +110,27 @@ in
98110 '';
99111 };
100112
113+ setupScript = mkOption {
114+ type = types.str;
115+ default = "";
116+ example = ''
117+ # workaround for using NVIDIA Optimus without Bumblebee
118+ xrandr --setprovideroutputsource modesetting NVIDIA-0
119+ xrandr --auto
120+ '';
121+ description = ''
122+ A script to execute when starting the display server.
123+ '';
124+ };
125+
126+ stopScript = mkOption {
127+ type = types.str;
128+ default = "";
129+ description = ''
130+ A script to execute when stopping the display server.
131+ '';
132+ };
133+
101134 autoLogin = mkOption {
102135 default = {};
103136 description = ''