1{
2 config,
3 lib,
4 options,
5 ...
6}:
7{
8
9 ###### interface
10
11 options = {
12
13 systemd.enableEmergencyMode = lib.mkOption {
14 default = true;
15 type = lib.types.bool;
16 description = ''
17 Whether to enable emergency mode, which is an
18 {command}`sulogin` shell started on the console if
19 mounting a filesystem fails. Since some machines (like EC2
20 instances) have no console of any kind, emergency mode doesn't
21 make sense, and it's better to continue with the boot insofar
22 as possible.
23
24 For initrd emergency access, use ${options.boot.initrd.systemd.emergencyAccess} instead.
25 '';
26 };
27
28 };
29
30 ###### implementation
31
32 config = {
33
34 systemd.additionalUpstreamSystemUnits = lib.optionals config.systemd.enableEmergencyMode [
35 "emergency.target"
36 "emergency.service"
37 ];
38
39 };
40
41}