nixos/kexec: add enable option

It is still enabled by default but now you can actively exclude it if
you don't need it.

nikstur 9e0ac0c7 898ebf78

Changed files
+17 -2
nixos
modules
system
boot
+17 -2
nixos/modules/system/boot/kexec.nix
···
-
{ pkgs, lib, ... }:
+
{
+
config,
+
pkgs,
+
lib,
+
...
+
}:
+
let
+
cfg = config.boot.kexec;
+
in
{
-
config = lib.mkIf (lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.kexec-tools) {
+
options.boot.kexec = {
+
enable = lib.mkEnableOption "kexec" // {
+
default = lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.kexec-tools;
+
defaultText = lib.literalExpression ''lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.kexec-tools'';
+
};
+
};
+
+
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.kexec-tools ];
systemd.services.prepare-kexec = {