diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix index ca0832e5b0c8..bad99ccd8696 100644 --- a/nixos/modules/services/x11/display-managers/default.nix +++ b/nixos/modules/services/x11/display-managers/default.nix @@ -37,7 +37,7 @@ let # file provided by services.xserver.displayManager.session.script xsession = wm: dm: pkgs.writeScript "xsession" '' - #! /bin/sh + #! ${pkgs.bash}/bin/bash . /etc/profile cd "$HOME" diff --git a/nixos/modules/services/x11/display-managers/lightdm.nix b/nixos/modules/services/x11/display-managers/lightdm.nix index c8ccf43029dc..ded694d90d50 100644 --- a/nixos/modules/services/x11/display-managers/lightdm.nix +++ b/nixos/modules/services/x11/display-managers/lightdm.nix @@ -13,9 +13,16 @@ let # lightdm runs with clearenv(), but we need a few things in the enviornment for X to startup xserverWrapper = writeScript "xserver-wrapper" '' - #! /bin/sh + #! ${pkgs.bash}/bin/bash ${concatMapStrings (n: "export ${n}=\"${getAttr n xEnv}\"\n") (attrNames xEnv)} - exec ${dmcfg.xserverBin} ${dmcfg.xserverArgs} + + display=$(echo "$@" | xargs -n 1 | grep -P ^:\\d\$ | head -n 1 | sed s/^://) + if [ -z "$display" ] + then additionalArgs=":0 -logfile /var/log/X.0.log" + else additionalArgs="-logfile /var/log/X.$display.log" + fi + + exec ${dmcfg.xserverBin} ${dmcfg.xserverArgs} $additionalArgs "$@" ''; usersConf = writeText "users.conf" @@ -39,7 +46,6 @@ let greeter-session = ${cfg.greeter.name} ${cfg.extraSeatDefaults} ''; - in { # Note: the order in which lightdm greeter modules are imported @@ -98,7 +104,6 @@ in }; config = mkIf cfg.enable { - services.xserver.displayManager.slim.enable = false; services.xserver.displayManager.job = { @@ -149,5 +154,7 @@ in services.xserver.displayManager.lightdm.background = mkDefault "${pkgs.nixos-artwork}/share/artwork/gnome/Gnome_Dark.png"; + services.xserver.tty = null; # We might start multiple X servers so let the tty increment themselves.. + services.xserver.display = null; # We specify our own display (and logfile) in xserver-wrapper up there }; } diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index 3348e8d0582c..8fcca70bc796 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -381,13 +381,13 @@ in }; tty = mkOption { - type = types.int; + type = types.nullOr types.int; default = 7; description = "Virtual console for the X server."; }; display = mkOption { - type = types.int; + type = types.nullOr types.int; default = 0; description = "Display number for the X server."; }; @@ -517,11 +517,12 @@ in services.xserver.displayManager.xserverArgs = [ "-ac" "-terminate" - "-logfile" "/var/log/X.${toString cfg.display}.log" "-config ${configFile}" - ":${toString cfg.display}" "vt${toString cfg.tty}" "-xkbdir" "${pkgs.xkeyboard_config}/etc/X11/xkb" - ] ++ optional (!cfg.enableTCP) "-nolisten tcp"; + ] ++ optional (cfg.display != null) ":${tostring cfg.display}" + ++ optional (cfg.tty != null) "vt${toString cfg.tty}" + ++ optional (cfg.display != null) [ "-logfile" "/var/log/X.${toString cfg.display}.log" ] + ++ optional (!cfg.enableTCP) "-nolisten tcp"; services.xserver.modules = concatLists (catAttrs "modules" cfg.drivers) ++ diff --git a/pkgs/misc/screensavers/light-locker/default.nix b/pkgs/misc/screensavers/light-locker/default.nix new file mode 100644 index 000000000000..48b30bccbdd8 --- /dev/null +++ b/pkgs/misc/screensavers/light-locker/default.nix @@ -0,0 +1,43 @@ +{ stdenv +, fetchFromGitHub +, which +, xfce +, glib +, pkgconfig +, libX11 +, gtk3 +, dbus_glib +, systemd +, wrapGAppsHook +}: + +stdenv.mkDerivation rec { + name = "${basename}-${version}"; + basename = "light-locker"; + version = "1.7.0"; + + src = fetchFromGitHub { + owner = "the-cavalry"; + repo = basename; + rev = "v${version}"; + sha256 = "0ygkp5vgkx2nfhfql6j2jsfay394gda23ir3sx4f72j4agsirjvj"; + }; + + buildInputs = [ which xfce.xfce4_dev_tools glib pkgconfig libX11 gtk3 dbus_glib systemd wrapGAppsHook ]; + + preConfigure = '' + ./autogen.sh + ''; + + meta = with stdenv.lib; { + homepage = https://github.com/the-cavalry/light-locker; + description = "light-locker is a simple locker"; + longDescription = '' + light-locker is a simple locker (forked from gnome-screensaver) that aims to have simple, sane, secure defaults and be well integrated with the desktop while not carrying any desktop-specific dependencies. + It relies on lightdm for locking and unlocking your session via ConsoleKit/UPower or logind/systemd. + ''; + license = licenses.gpl2; + maintainers = with maintainers; [ obadz ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5b6baaee46d5..674a3ea639ed 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7752,6 +7752,8 @@ let lightning = callPackage ../development/libraries/lightning { }; + lightlocker = callPackage ../misc/screensavers/light-locker { }; + lirc = callPackage ../development/libraries/lirc { }; liquidfun = callPackage ../development/libraries/liquidfun { };