You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tourmaline/configs/crystal/create-partitions/up.nu

50 lines
1.2 KiB
Plaintext

module auto_partition {
export def efi [device: string] {
info "Creating efi partitions"
efi_layout $device
}
def efi_layout [device: string] {
run parted -s $device mklabel gpt
debug "Partition table created"
run parted -s $device mkpart fat32 0 300
debug "EFI partition created"
run parted -s $device mkpart primary btrfs 512MIB 100%
debug "Root partition created"
}
export def bios [device: string] {
debug "Creating bios partitions"
bios_layout $device
}
def bios_layout [device: string] {
parted -s $device mklabel msdos
parted -s $device mkpart primary ext4 1MIB 512MIB
parted -s $device mkpart primary btrfs 512MIB 100%
}
}
# Applies all system changes of `create-partitions`
def main [cfg] {
debug $"Creating partitions with config ($cfg)"
if $cfg.partitions == "Auto" {
info "Creating partitions automatically..."
use auto_partition
if $cfg.efi_partition {
auto_partition efi $cfg.device
} else {
auto_partition bios $cfg.device
}
} else {
info "Creating partitions manually"
}
info "Partitions created"
}