From 3530f3f20a934ed1d3df35fe3c8041d197f8b41e Mon Sep 17 00:00:00 2001 From: Christian Kauhaus Date: Tue, 19 Jul 2016 09:42:53 +0200 Subject: [PATCH] systemd: make ctrl-alt-del target configurable. (#16911) We currently only allow upstream's default of "reboot.target" due to the way the symlinks are initialized. I made this configurable similar to the default unit. --- nixos/modules/system/boot/systemd-lib.nix | 2 +- nixos/modules/system/boot/systemd.nix | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/nixos/modules/system/boot/systemd-lib.nix b/nixos/modules/system/boot/systemd-lib.nix index 8acaa5212f5f..2e93693cbfc8 100644 --- a/nixos/modules/system/boot/systemd-lib.nix +++ b/nixos/modules/system/boot/systemd-lib.nix @@ -176,7 +176,7 @@ rec { ${optionalString (type == "system") '' # Stupid misc. symlinks. ln -s ${cfg.defaultUnit} $out/default.target - + ln -s ${cfg.ctrlAltDelUnit} $out/ctrl-alt-del.target ln -s rescue.target $out/kbrequest.target mkdir -p $out/getty.target.wants/ diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 5c8cce5066af..df72be1b4be5 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -120,7 +120,6 @@ let "systemd-poweroff.service" "halt.target" "systemd-halt.service" - "ctrl-alt-del.target" "shutdown.target" "umount.target" "final.target" @@ -162,7 +161,6 @@ let "systemd-hostnamed.service" "systemd-binfmt.service" ] - ++ cfg.additionalUpstreamSystemUnits; upstreamSystemWants = @@ -485,6 +483,15 @@ in description = "Default unit started when the system boots."; }; + systemd.ctrlAltDelUnit = mkOption { + default = "reboot.target"; + type = types.str; + example = "poweroff.target"; + description = '' + Target that should be started when Ctrl-Alt-Delete is pressed. + ''; + }; + systemd.globalEnvironment = mkOption { type = types.attrs; default = {};