From b07fa98f82ac44801dc34b6b143048ee28f7e1a3 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sat, 12 Dec 2015 11:31:26 -0600 Subject: [PATCH 1/3] 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. --- .../services/x11/display-managers/sddm.nix | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) 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 = '' From 73a9826001873ae5dc861fc086d6265cadf9e3e4 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sat, 12 Dec 2015 11:32:20 -0600 Subject: [PATCH 2/3] sddm: don't install empty scripts --- pkgs/applications/display-managers/sddm/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/applications/display-managers/sddm/default.nix b/pkgs/applications/display-managers/sddm/default.nix index d2faf465106..b7bf5ee5664 100644 --- a/pkgs/applications/display-managers/sddm/default.nix +++ b/pkgs/applications/display-managers/sddm/default.nix @@ -45,6 +45,11 @@ let enableParallelBuilding = true; + postInstall = '' + # remove empty scripts + rm "$out/share/sddm/scripts/Xsetup" "$out/share/sddm/scripts/Xstop" + ''; + meta = with stdenv.lib; { description = "QML based X11 display manager"; homepage = https://github.com/sddm/sddm; From fac138a2f5a784694b652f7f1f8767e7882d542c Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sat, 12 Dec 2015 11:33:39 -0600 Subject: [PATCH 3/3] nixos/sddm: fix indentation --- .../modules/services/x11/display-managers/sddm.nix | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/nixos/modules/services/x11/display-managers/sddm.nix b/nixos/modules/services/x11/display-managers/sddm.nix index 50e6a85b4f2..bcac83aa738 100644 --- a/nixos/modules/services/x11/display-managers/sddm.nix +++ b/nixos/modules/services/x11/display-managers/sddm.nix @@ -138,7 +138,7 @@ in ''; type = types.submodule { - options = { + options = { enable = mkOption { type = types.bool; default = false; @@ -163,7 +163,7 @@ in will work only the first time. ''; }; - }; + }; }; }; @@ -175,14 +175,16 @@ in assertions = [ { assertion = cfg.autoLogin.enable -> cfg.autoLogin.user != null; - message = "SDDM auto-login requires services.xserver.displayManager.sddm.autoLogin.user to be set"; + message = '' + SDDM auto-login requires services.xserver.displayManager.sddm.autoLogin.user to be set + ''; } { assertion = cfg.autoLogin.enable -> elem defaultSessionName dmcfg.session.names; message = '' SDDM auto-login requires that services.xserver.desktopManager.default and - services.xserver.windowMananger.default are set to valid values. The current - default session: ${defaultSessionName} is not valid. - ''; + services.xserver.windowMananger.default are set to valid values. The current + default session: ${defaultSessionName} is not valid. + ''; } ];