1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7 cfg = config.services.xserver.displayManager.startx;
8
9in
10
11{
12
13 ###### interface
14
15 options = {
16 services.xserver.displayManager.startx = {
17 enable = mkOption {
18 type = types.bool;
19 default = false;
20 description = ''
21 Whether to enable the dummy "startx" pseudo-display manager,
22 which allows users to start X manually via the "startx" command
23 from a vt shell. The X server runs under the user's id, not as root.
24 The user must provide a ~/.xinitrc file containing session startup
25 commands, see startx(1). This is not automatically generated
26 from the desktopManager and windowManager settings.
27 '';
28 };
29 };
30 };
31
32
33 ###### implementation
34
35 config = mkIf cfg.enable {
36 services.xserver = {
37 exportConfiguration = true;
38 };
39
40 # Other displayManagers log to /dev/null because they're services and put
41 # Xorg's stdout in the journal
42 #
43 # To send log to Xorg's default log location ($XDG_DATA_HOME/xorg/), we do
44 # not specify a log file when running X
45 services.xserver.logFile = mkDefault null;
46
47 # Implement xserverArgs via xinit's system-wide xserverrc
48 environment.etc."X11/xinit/xserverrc".source = pkgs.writeShellScript "xserverrc" ''
49 exec ${pkgs.xorg.xorgserver}/bin/X ${toString config.services.xserver.displayManager.xserverArgs} "$@"
50 '';
51 environment.systemPackages = with pkgs; [ xorg.xinit ];
52 };
53
54}