{ config, pkgs, lib, ... }: with lib; let cfg = config.kexec.justdoit; x = if cfg.nvme then "p" else ""; 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"; }; bootType = mkOption { type = types.enum [ "ext4" "vfat" "zfs" ]; default = "ext4"; }; swapSize = mkOption { type = types.int; default = 1024; description = "size of swap in mb"; }; poolName = mkOption { type = types.str; default = "tank"; description = "zfs pool name"; }; luksEncrypt = mkOption { type = types.bool; default = false; description = "encrypt all of zfs and swap"; }; uefi = mkOption { type = types.bool; default = false; description = "create a uefi install"; }; nvme = mkOption { type = types.bool; default = false; description = "rootDevice is nvme"; }; }; }; config = let mkBootTable = { ext4 = "mkfs.ext4 $NIXOS_BOOT -L NIXOS_BOOT"; vfat = "mkfs.vfat $NIXOS_BOOT -n NIXOS_BOOT"; zfs = ""; }; in lib.mkIf true { system.build.justdoit = pkgs.writeScriptBin "justdoit" '' #!${pkgs.stdenv.shell} set -e vgchange -a n wipefs -a ${cfg.rootDevice} dd if=/dev/zero of=${cfg.rootDevice} bs=512 count=10000 sfdisk ${cfg.rootDevice} < /mnt/etc/nixos/generated.nix <