nixos/systemd: convert sleep.extraConfig to RFC42-style settings (#493223)

This commit is contained in:
zowoq
2026-03-03 22:49:24 +00:00
committed by GitHub
2 changed files with 18 additions and 10 deletions
@@ -211,6 +211,8 @@ See <https://github.com/NixOS/nixpkgs/issues/481673>.
- [services.resolved](#opt-services.resolved.enable) module was converted to RFC42-style settings. The moved options have also been renamed to match the upstream names. Aliases mean current configs will continue to function, but users should move to the new options as convenient.
- `systemd.sleep.extraConfig` was replaced by [RFC 0042](https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md)-compliant `systemd.sleep.settings.Sleep`, which is used to generate the `sleep.conf` configuration file. See {manpage}`sleep.conf.d(5)` for available options.
- Support for Bluetooth audio based on `bluez-alsa` has been added to the `hardware.alsa` module. It can be enabled with the new [enableBluetooth](#opt-hardware.alsa.enableBluetooth) option.
- `services.openssh` now supports generating host SSH keys by setting `services.openssh.generateHostKeys = true` while leaving `services.openssh.enable` disabled. This is particularly useful for systems that have no need of an SSH daemon but want SSH host keys for other purposes such as using agenix or sops-nix.
+16 -10
View File
@@ -470,13 +470,17 @@ in
'';
};
sleep.extraConfig = mkOption {
default = "";
type = types.lines;
example = "HibernateDelaySec=1h";
sleep.settings.Sleep = mkOption {
default = { };
type = lib.types.submodule {
freeformType = types.attrsOf unitOption;
};
example = {
HibernateDelaySec = "1h";
};
description = ''
Extra config options for systemd sleep state logic.
See {manpage}`sleep.conf.d(5)` man page for available options.
Options for systemd sleep state logic. See {manpage}`sleep.conf.d(5)` man page
for available options.
'';
};
@@ -637,10 +641,7 @@ in
"systemd/system.conf".text = settingsToSections cfg.settings;
"systemd/sleep.conf".text = ''
[Sleep]
${cfg.sleep.extraConfig}
'';
"systemd/sleep.conf".text = settingsToSections cfg.sleep.settings;
"systemd/user-generators" = {
source = hooks "user-generators" cfg.user.generators;
@@ -878,6 +879,11 @@ in
NixOS does not officially support this configuration and might cause your system to be unbootable in future versions. You are on your own.
'')
(mkRemovedOptionModule [ "systemd" "extraConfig" ] "Use systemd.settings.Manager instead.")
(mkRemovedOptionModule [
"systemd"
"sleep"
"extraConfig"
] "Use systemd.sleep.settings.Sleep instead.")
(lib.mkRenamedOptionModule
[ "systemd" "watchdog" "device" ]
[ "systemd" "settings" "Manager" "WatchdogDevice" ]