2025-05-24 13:34:38 +07:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
options,
|
|
|
|
...
|
|
|
|
}:
|
2014-07-25 14:05:57 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
2024-08-28 21:19:12 +02:00
|
|
|
systemd.enableEmergencyMode = lib.mkOption {
|
2014-07-25 14:05:57 -04:00
|
|
|
default = true;
|
2024-08-28 21:19:12 +02:00
|
|
|
type = lib.types.bool;
|
2014-07-25 14:05:57 -04:00
|
|
|
description = ''
|
|
|
|
Whether to enable emergency mode, which is an
|
|
|
|
{command}`sulogin` shell started on the console if
|
|
|
|
mounting a filesystem fails. Since some machines (like EC2
|
|
|
|
instances) have no console of any kind, emergency mode doesn't
|
|
|
|
make sense, and it's better to continue with the boot insofar
|
|
|
|
as possible.
|
2025-05-24 13:34:38 +07:00
|
|
|
|
|
|
|
For initrd emergency access, use ${options.boot.initrd.systemd.emergencyAccess} instead.
|
2014-07-25 14:05:57 -04:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
2024-08-28 21:19:12 +02:00
|
|
|
systemd.additionalUpstreamSystemUnits = lib.optionals config.systemd.enableEmergencyMode [
|
2014-07-25 14:05:57 -04:00
|
|
|
"emergency.target"
|
|
|
|
"emergency.service"
|
|
|
|
];
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2020-08-08 10:54:16 +10:00
|
|
|
}
|