599c4df46a
This sort of code breaks config.{allowBroken, allowUnsupportedSystem} = true by making them do unpredictable things.
23 lines
754 B
Nix
23 lines
754 B
Nix
{ pkgs, lib, ... }:
|
|
|
|
{
|
|
config = lib.mkIf (lib.any (lib.meta.platformMatch pkgs.stdenv.hostPlatform) pkgs.kexectools.meta.platform) {
|
|
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"
|
|
'';
|
|
};
|
|
};
|
|
}
|