summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorJoachim F <joachifm@users.noreply.github.com>2018-10-15 11:25:19 +0000
committerGitHub <noreply@github.com>2018-10-15 11:25:19 +0000
commita179d44bd198f42075d1aa61f22ec05c21f9d5b9 (patch)
tree159fc3635843a6654d7398ace84f86732eaf8d4c /nixos
parent6c60014759e13cb95aa672770d3ffe5886485940 (diff)
parent73de0734057b2b0b5203a92e941e6f13fdf1b488 (diff)
downloadnixlib-a179d44bd198f42075d1aa61f22ec05c21f9d5b9.tar
nixlib-a179d44bd198f42075d1aa61f22ec05c21f9d5b9.tar.gz
nixlib-a179d44bd198f42075d1aa61f22ec05c21f9d5b9.tar.bz2
nixlib-a179d44bd198f42075d1aa61f22ec05c21f9d5b9.tar.lz
nixlib-a179d44bd198f42075d1aa61f22ec05c21f9d5b9.tar.xz
nixlib-a179d44bd198f42075d1aa61f22ec05c21f9d5b9.tar.zst
nixlib-a179d44bd198f42075d1aa61f22ec05c21f9d5b9.zip
Merge pull request #47538 from xaverdh/kmscon-autologin
nixos/kmscon: Add autologin option
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/ttys/kmscon.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/nixos/modules/services/ttys/kmscon.nix b/nixos/modules/services/ttys/kmscon.nix
index 59c45fcb44ee..82b6a51028e3 100644
--- a/nixos/modules/services/ttys/kmscon.nix
+++ b/nixos/modules/services/ttys/kmscon.nix
@@ -4,6 +4,8 @@ let
 
   cfg = config.services.kmscon;
 
+  autologinArg = lib.optionalString (cfg.autologinUser != null) "-f ${cfg.autologinUser}";
+
   configDir = pkgs.writeTextFile { name = "kmscon-config"; destination = "/kmscon.conf"; text = cfg.extraConfig; };
 in {
   options = {
@@ -39,6 +41,15 @@ in {
         default = "";
         example = "--term xterm-256color";
       };
+
+      autologinUser = mkOption {
+        type = types.nullOr types.str;
+        default = null;
+        description = ''
+          Username of the account that will be automatically logged in at the console.
+          If unspecified, a login prompt is shown as usual.
+        '';
+      };
     };
   };
 
@@ -61,7 +72,7 @@ in {
 
       [Service]
       ExecStart=
-      ExecStart=${pkgs.kmscon}/bin/kmscon "--vt=%I" ${cfg.extraOptions} --seats=seat0 --no-switchvt --configdir ${configDir} --login -- ${pkgs.shadow}/bin/login -p
+      ExecStart=${pkgs.kmscon}/bin/kmscon "--vt=%I" ${cfg.extraOptions} --seats=seat0 --no-switchvt --configdir ${configDir} --login -- ${pkgs.shadow}/bin/login -p ${autologinArg}
       UtmpIdentifier=%I
       TTYPath=/dev/%I
       TTYReset=yes