summary refs log blame commit diff
path: root/modules/services/x11/display-managers/auto.nix
blob: cccc6e62a15313e79302dd973c6a00c535077f7f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                 
 
                                            
 























                                                                  
                                                        
 


                                         
                                               







                                                                        
{ config, pkgs, ... }:

with pkgs.lib;

let

  dmcfg = config.services.xserver.displayManager;
  cfg = dmcfg.auto;

in

{

  ###### interface

  options = {

    services.xserver.displayManager.auto = {

      enable = mkOption {
        default = false;
        description = ''
          Whether to enable the fake "auto" display manager, which
          automatically logs in the user specified in the
          <option>user</option> option.  This is mostly useful for
          automated tests.
        '';
      };

      user = mkOption {
        default = "root";
        description = "The user account to login automatically.";
      };

    };

  };


  ###### implementation

  config = mkIf cfg.enable {

    services.xserver.displayManager.slim.enable = false;

    services.xserver.displayManager.job =
      { execCmd =
          ''
            exec ${pkgs.xorg.xinit}/bin/xinit \
              ${pkgs.su}/bin/su -c ${dmcfg.session.script} ${cfg.user} \
              -- ${dmcfg.xserverBin} ${dmcfg.xserverArgs}
          '';
      };

  };

}