You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
705 B

  1. { config, pkgs, lib, ... }:
  2. {
  3. config = lib.mkIf (pkgs.kexectools.meta.available) {
  4. environment.systemPackages = [ pkgs.kexectools ];
  5. systemd.services."prepare-kexec" =
  6. { description = "Preparation for kexec";
  7. wantedBy = [ "kexec.target" ];
  8. before = [ "systemd-kexec.service" ];
  9. unitConfig.DefaultDependencies = false;
  10. serviceConfig.Type = "oneshot";
  11. path = [ pkgs.kexectools ];
  12. script =
  13. ''
  14. p=$(readlink -f /nix/var/nix/profiles/system)
  15. if ! [ -d $p ]; then exit 1; fi
  16. exec kexec --load $p/kernel --initrd=$p/initrd --append="$(cat $p/kernel-params) init=$p/init"
  17. '';
  18. };
  19. };
  20. }