Merge pull request #268997 from nbraud/nixos/systemd/refactor

nixos/systemd: Refactor & link manpages in option descriptions

authored by Maciej Krüger and committed by GitHub 1aeb6d14 0663331e

+99 -91
+99 -91
nixos/modules/system/boot/systemd.nix
··· 177 177 { 178 178 ###### interface 179 179 180 - options = { 180 + options.systemd = { 181 181 182 - systemd.package = mkOption { 183 - default = pkgs.systemd; 184 - defaultText = literalExpression "pkgs.systemd"; 185 - type = types.package; 186 - description = lib.mdDoc "The systemd package."; 187 - }; 182 + package = mkPackageOption pkgs "systemd" {}; 188 183 189 - systemd.units = mkOption { 190 - description = lib.mdDoc "Definition of systemd units."; 184 + units = mkOption { 185 + description = "Definition of systemd units; see {manpage}`systemd.unit(5)`."; 191 186 default = {}; 192 187 type = systemdUtils.types.units; 193 188 }; 194 189 195 - systemd.packages = mkOption { 190 + packages = mkOption { 196 191 default = []; 197 192 type = types.listOf types.package; 198 193 example = literalExpression "[ pkgs.systemd-cryptsetup-generator ]"; 199 - description = lib.mdDoc "Packages providing systemd units and hooks."; 194 + description = "Packages providing systemd units and hooks."; 200 195 }; 201 196 202 - systemd.targets = mkOption { 197 + targets = mkOption { 203 198 default = {}; 204 199 type = systemdUtils.types.targets; 205 - description = lib.mdDoc "Definition of systemd target units."; 200 + description = "Definition of systemd target units; see {manpage}`systemd.target(5)`"; 206 201 }; 207 202 208 - systemd.services = mkOption { 203 + services = mkOption { 209 204 default = {}; 210 205 type = systemdUtils.types.services; 211 - description = lib.mdDoc "Definition of systemd service units."; 206 + description = "Definition of systemd service units; see {manpage}`systemd.service(5)`."; 212 207 }; 213 208 214 - systemd.sockets = mkOption { 209 + sockets = mkOption { 215 210 default = {}; 216 211 type = systemdUtils.types.sockets; 217 - description = lib.mdDoc "Definition of systemd socket units."; 212 + description = "Definition of systemd socket units; see {manpage}`systemd.socket(5)`."; 218 213 }; 219 214 220 - systemd.timers = mkOption { 215 + timers = mkOption { 221 216 default = {}; 222 217 type = systemdUtils.types.timers; 223 - description = lib.mdDoc "Definition of systemd timer units."; 218 + description = "Definition of systemd timer units; see {manpage}`systemd.timer(5)`."; 224 219 }; 225 220 226 - systemd.paths = mkOption { 221 + paths = mkOption { 227 222 default = {}; 228 223 type = systemdUtils.types.paths; 229 - description = lib.mdDoc "Definition of systemd path units."; 224 + description = "Definition of systemd path units; see {manpage}`systemd.path(5)`."; 230 225 }; 231 226 232 - systemd.mounts = mkOption { 227 + mounts = mkOption { 233 228 default = []; 234 229 type = systemdUtils.types.mounts; 235 - description = lib.mdDoc '' 236 - Definition of systemd mount units. 237 - This is a list instead of an attrSet, because systemd mandates the names to be derived from 238 - the 'where' attribute. 230 + description = '' 231 + Definition of systemd mount units; see {manpage}`systemd.mount(5)`. 232 + 233 + This is a list instead of an attrSet, because systemd mandates 234 + the names to be derived from the `where` attribute. 239 235 ''; 240 236 }; 241 237 242 - systemd.automounts = mkOption { 238 + automounts = mkOption { 243 239 default = []; 244 240 type = systemdUtils.types.automounts; 245 - description = lib.mdDoc '' 246 - Definition of systemd automount units. 247 - This is a list instead of an attrSet, because systemd mandates the names to be derived from 248 - the 'where' attribute. 241 + description = '' 242 + Definition of systemd automount units; see {manpage}`systemd.automount(5)`. 243 + 244 + This is a list instead of an attrSet, because systemd mandates 245 + the names to be derived from the `where` attribute. 249 246 ''; 250 247 }; 251 248 252 - systemd.slices = mkOption { 249 + slices = mkOption { 253 250 default = {}; 254 251 type = systemdUtils.types.slices; 255 - description = lib.mdDoc "Definition of slice configurations."; 252 + description = "Definition of slice configurations; see {manpage}`systemd.slice(5)`."; 256 253 }; 257 254 258 - systemd.generators = mkOption { 255 + generators = mkOption { 259 256 type = types.attrsOf types.path; 260 257 default = {}; 261 258 example = { systemd-gpt-auto-generator = "/dev/null"; }; 262 - description = lib.mdDoc '' 263 - Definition of systemd generators. 259 + description = '' 260 + Definition of systemd generators; see {manpage}`systemd.generator(5)`. 261 + 264 262 For each `NAME = VALUE` pair of the attrSet, a link is generated from 265 263 `/etc/systemd/system-generators/NAME` to `VALUE`. 266 264 ''; 267 265 }; 268 266 269 - systemd.shutdown = mkOption { 267 + shutdown = mkOption { 270 268 type = types.attrsOf types.path; 271 269 default = {}; 272 - description = lib.mdDoc '' 270 + description = '' 273 271 Definition of systemd shutdown executables. 274 272 For each `NAME = VALUE` pair of the attrSet, a link is generated from 275 273 `/etc/systemd/system-shutdown/NAME` to `VALUE`. 276 274 ''; 277 275 }; 278 276 279 - systemd.defaultUnit = mkOption { 277 + defaultUnit = mkOption { 280 278 default = "multi-user.target"; 281 279 type = types.str; 282 - description = lib.mdDoc "Default unit started when the system boots."; 280 + description = '' 281 + Default unit started when the system boots; see {manpage}`systemd.special(7)`. 282 + ''; 283 283 }; 284 284 285 - systemd.ctrlAltDelUnit = mkOption { 285 + ctrlAltDelUnit = mkOption { 286 286 default = "reboot.target"; 287 287 type = types.str; 288 288 example = "poweroff.target"; 289 - description = lib.mdDoc '' 290 - Target that should be started when Ctrl-Alt-Delete is pressed. 289 + description = '' 290 + Target that should be started when Ctrl-Alt-Delete is pressed; 291 + see {manpage}`systemd.special(7)`. 291 292 ''; 292 293 }; 293 294 294 - systemd.globalEnvironment = mkOption { 295 + globalEnvironment = mkOption { 295 296 type = with types; attrsOf (nullOr (oneOf [ str path package ])); 296 297 default = {}; 297 298 example = { TZ = "CET"; }; 298 - description = lib.mdDoc '' 299 + description = '' 299 300 Environment variables passed to *all* systemd units. 300 301 ''; 301 302 }; 302 303 303 - systemd.managerEnvironment = mkOption { 304 + managerEnvironment = mkOption { 304 305 type = with types; attrsOf (nullOr (oneOf [ str path package ])); 305 306 default = {}; 306 307 example = { SYSTEMD_LOG_LEVEL = "debug"; }; 307 - description = lib.mdDoc '' 308 + description = '' 308 309 Environment variables of PID 1. These variables are 309 310 *not* passed to started units. 310 311 ''; 311 312 }; 312 313 313 - systemd.enableCgroupAccounting = mkOption { 314 + enableCgroupAccounting = mkOption { 314 315 default = true; 315 316 type = types.bool; 316 - description = lib.mdDoc '' 317 - Whether to enable cgroup accounting. 317 + description = '' 318 + Whether to enable cgroup accounting; see {manpage}`cgroups(7)`. 318 319 ''; 319 320 }; 320 321 321 - systemd.enableUnifiedCgroupHierarchy = mkOption { 322 + enableUnifiedCgroupHierarchy = mkOption { 322 323 default = true; 323 324 type = types.bool; 324 - description = lib.mdDoc '' 325 - Whether to enable the unified cgroup hierarchy (cgroupsv2). 325 + description = '' 326 + Whether to enable the unified cgroup hierarchy (cgroupsv2); see {manpage}`cgroups(7)`. 326 327 ''; 327 328 }; 328 329 329 - systemd.extraConfig = mkOption { 330 + extraConfig = mkOption { 330 331 default = ""; 331 332 type = types.lines; 332 333 example = "DefaultLimitCORE=infinity"; 333 - description = lib.mdDoc '' 334 - Extra config options for systemd. See systemd-system.conf(5) man page 334 + description = '' 335 + Extra config options for systemd. See {manpage}`systemd-system.conf(5)` man page 335 336 for available options. 336 337 ''; 337 338 }; 338 339 339 - systemd.sleep.extraConfig = mkOption { 340 + sleep.extraConfig = mkOption { 340 341 default = ""; 341 342 type = types.lines; 342 343 example = "HibernateDelaySec=1h"; 343 - description = lib.mdDoc '' 344 + description = '' 344 345 Extra config options for systemd sleep state logic. 345 - See sleep.conf.d(5) man page for available options. 346 + See {manpage}`sleep.conf.d(5)` man page for available options. 346 347 ''; 347 348 }; 348 349 349 - systemd.additionalUpstreamSystemUnits = mkOption { 350 + additionalUpstreamSystemUnits = mkOption { 350 351 default = [ ]; 351 352 type = types.listOf types.str; 352 353 example = [ "debug-shell.service" "systemd-quotacheck.service" ]; 353 - description = lib.mdDoc '' 354 + description = '' 354 355 Additional units shipped with systemd that shall be enabled. 355 356 ''; 356 357 }; 357 358 358 - systemd.suppressedSystemUnits = mkOption { 359 + suppressedSystemUnits = mkOption { 359 360 default = [ ]; 360 361 type = types.listOf types.str; 361 362 example = [ "systemd-backlight@.service" ]; 362 - description = lib.mdDoc '' 363 + description = '' 363 364 A list of units to skip when generating system systemd configuration directory. This has 364 365 priority over upstream units, {option}`systemd.units`, and 365 366 {option}`systemd.additionalUpstreamSystemUnits`. The main purpose of this is to ··· 368 369 ''; 369 370 }; 370 371 371 - systemd.watchdog.device = mkOption { 372 + watchdog.device = mkOption { 372 373 type = types.nullOr types.path; 373 374 default = null; 374 375 example = "/dev/watchdog"; 375 - description = lib.mdDoc '' 376 + description = '' 376 377 The path to a hardware watchdog device which will be managed by systemd. 377 - If not specified, systemd will default to /dev/watchdog. 378 + If not specified, systemd will default to `/dev/watchdog`. 378 379 ''; 379 380 }; 380 381 381 - systemd.watchdog.runtimeTime = mkOption { 382 + watchdog.runtimeTime = mkOption { 382 383 type = types.nullOr types.str; 383 384 default = null; 384 385 example = "30s"; 385 - description = lib.mdDoc '' 386 + description = '' 386 387 The amount of time which can elapse before a watchdog hardware device 387 - will automatically reboot the system. Valid time units include "ms", 388 - "s", "min", "h", "d", and "w". 388 + will automatically reboot the system. 389 + 390 + Valid time units include "ms", "s", "min", "h", "d", and "w"; 391 + see {manpage}`systemd.time(7)`. 389 392 ''; 390 393 }; 391 394 392 - systemd.watchdog.rebootTime = mkOption { 395 + watchdog.rebootTime = mkOption { 393 396 type = types.nullOr types.str; 394 397 default = null; 395 398 example = "10m"; 396 - description = lib.mdDoc '' 399 + description = '' 397 400 The amount of time which can elapse after a reboot has been triggered 398 401 before a watchdog hardware device will automatically reboot the system. 399 - Valid time units include "ms", "s", "min", "h", "d", and "w". If left 400 - `null`, systemd will use its default of `10min`; see also {command}`man 401 - 5 systemd-system.conf`. 402 + If left `null`, systemd will use its default of 10 minutes; 403 + see {manpage}`systemd-system.conf(5)`. 404 + 405 + Valid time units include "ms", "s", "min", "h", "d", and "w"; 406 + see also {manpage}`systemd.time(7)`. 402 407 ''; 403 408 }; 404 409 405 - systemd.watchdog.kexecTime = mkOption { 410 + watchdog.kexecTime = mkOption { 406 411 type = types.nullOr types.str; 407 412 default = null; 408 413 example = "10m"; 409 - description = lib.mdDoc '' 410 - The amount of time which can elapse when kexec is being executed before 414 + description = '' 415 + The amount of time which can elapse when `kexec` is being executed before 411 416 a watchdog hardware device will automatically reboot the system. This 412 - option should only be enabled if reloadTime is also enabled. Valid 413 - time units include "ms", "s", "min", "h", "d", and "w". 417 + option should only be enabled if `reloadTime` is also enabled; 418 + see {manpage}`kexec(8)`. 419 + 420 + Valid time units include "ms", "s", "min", "h", "d", and "w"; 421 + see also {manpage}`systemd.time(7)`. 414 422 ''; 415 423 }; 416 424 }; ··· 493 501 "systemd/system.conf".text = '' 494 502 [Manager] 495 503 ManagerEnvironment=${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "${n}=${lib.escapeShellArg v}") cfg.managerEnvironment)} 496 - ${optionalString config.systemd.enableCgroupAccounting '' 504 + ${optionalString cfg.enableCgroupAccounting '' 497 505 DefaultCPUAccounting=yes 498 506 DefaultIOAccounting=yes 499 507 DefaultBlockIOAccounting=yes 500 508 DefaultIPAccounting=yes 501 509 ''} 502 510 DefaultLimitCORE=infinity 503 - ${optionalString (config.systemd.watchdog.device != null) '' 504 - WatchdogDevice=${config.systemd.watchdog.device} 511 + ${optionalString (cfg.watchdog.device != null) '' 512 + WatchdogDevice=${cfg.watchdog.device} 505 513 ''} 506 - ${optionalString (config.systemd.watchdog.runtimeTime != null) '' 507 - RuntimeWatchdogSec=${config.systemd.watchdog.runtimeTime} 514 + ${optionalString (cfg.watchdog.runtimeTime != null) '' 515 + RuntimeWatchdogSec=${cfg.watchdog.runtimeTime} 508 516 ''} 509 - ${optionalString (config.systemd.watchdog.rebootTime != null) '' 510 - RebootWatchdogSec=${config.systemd.watchdog.rebootTime} 517 + ${optionalString (cfg.watchdog.rebootTime != null) '' 518 + RebootWatchdogSec=${cfg.watchdog.rebootTime} 511 519 ''} 512 - ${optionalString (config.systemd.watchdog.kexecTime != null) '' 513 - KExecWatchdogSec=${config.systemd.watchdog.kexecTime} 520 + ${optionalString (cfg.watchdog.kexecTime != null) '' 521 + KExecWatchdogSec=${cfg.watchdog.kexecTime} 514 522 ''} 515 523 516 - ${config.systemd.extraConfig} 524 + ${cfg.extraConfig} 517 525 ''; 518 526 519 527 "systemd/sleep.conf".text = '' 520 528 [Sleep] 521 - ${config.systemd.sleep.extraConfig} 529 + ${cfg.sleep.extraConfig} 522 530 ''; 523 531 524 532 "systemd/system-generators" = { source = hooks "generators" cfg.generators; };