aboutsummaryrefslogtreecommitdiffstats
path: root/layers/console.nix
blob: 378e3faa24fac1850581cd6215ab08b147ab749c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# A shell on the serial console, i.e. in the run script's terminal: root,
# logged in, unless services.getty.autologinUser says otherwise (another
# user, or null for a login prompt, which needs a password).  Small, so
# better imported by another layer than a layer, with an image, of its
# own:
#   imports = [ /path/to/firecracker/layers/console.nix ];
# though that works, too:
#   --arg layers '[ layers/console.nix ./my-layer.nix ]'
# Without it, the guest has no console (no getty, no kbd), and the way in
# is ssh (see users.users.<name>.openssh.authorizedKeys in a layer).
{ lib, ... }:
{
  # NixOS's gettys come with the console (services/ttys/getty.nix), and
  # with them kbd and systemd-vconsole-setup, which has nothing to do
  # here, but would still get started at boot.
  console.enable = true;
  systemd.units."systemd-vconsole-setup.service".enable = lib.mkForce false;

  # Only on ttyS0 (console= on the kernel command line, which systemd's
  # getty generator goes by), not on tty1.
  services.getty.autologinUser = lib.mkDefault "root";
  systemd.targets.getty.wants = lib.mkForce [ ];
}