{ config, pkgs, lib, ... }: with lib; let cfg = config.kexec.justdoit; in { options = { kexec.justdoit = { rootDevice = mkOption { type = types.str; default = "/dev/sda"; description = "the root block device that justdoit will nuke from orbit and force nixos onto"; }; bootSize = mkOption { type = types.int; default = 256; description = "size of /boot in mb"; }; swapSize = mkOption { type = types.int; default = 1024; description = "size of swap in mb"; }; }; }; config = lib.mkIf true { system.build.justdoit = pkgs.writeScriptBin "justdoit" '' #!${pkgs.stdenv.shell} set -e vgchange -a n dd if=/dev/zero of=${cfg.rootDevice} bs=512 count=10000 sfdisk ${cfg.rootDevice} < /mnt/etc/nixos/generated.nix <