mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-02 10:31:36 +00:00
cdf9a78a3e
The isKexecable flag treated Linux without kexec as just a normal variant, when it really should be treated as a special case incurring complexity debt to support.
23 lines
705 B
Nix
23 lines
705 B
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
{
|
|
config = lib.mkIf (pkgs.kexectools.meta.available) {
|
|
environment.systemPackages = [ pkgs.kexectools ];
|
|
|
|
systemd.services."prepare-kexec" =
|
|
{ description = "Preparation for kexec";
|
|
wantedBy = [ "kexec.target" ];
|
|
before = [ "systemd-kexec.service" ];
|
|
unitConfig.DefaultDependencies = false;
|
|
serviceConfig.Type = "oneshot";
|
|
path = [ pkgs.kexectools ];
|
|
script =
|
|
''
|
|
p=$(readlink -f /nix/var/nix/profiles/system)
|
|
if ! [ -d $p ]; then exit 1; fi
|
|
exec kexec --load $p/kernel --initrd=$p/initrd --append="$(cat $p/kernel-params) init=$p/init"
|
|
'';
|
|
};
|
|
};
|
|
}
|