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 displayManager.job.execCmd = "";
39 displayManager.lightdm.enable = lib.mkForce false;
40 };
41 systemd.services.display-manager.enable = false;
42
43 # Other displayManagers log to /dev/null because they're services and put
44 # Xorg's stdout in the journal
45 #
46 # To send log to Xorg's default log location ($XDG_DATA_HOME/xorg/), we do
47 # not specify a log file when running X
48 services.xserver.logFile = mkDefault null;
49
50 # Implement xserverArgs via xinit's system-wide xserverrc
51 environment.etc."X11/xinit/xserverrc".source = pkgs.writeShellScript "xserverrc" ''
52 exec ${pkgs.xorg.xorgserver}/bin/X ${toString config.services.xserver.displayManager.xserverArgs} "$@"
53 '';
54 environment.systemPackages = with pkgs; [ xorg.xinit ];
55 };
56
57}