Last active
December 14, 2022 12:30
-
-
Save berryp/a76c46486be6c69ce175b39f922f7ced to your computer and use it in GitHub Desktop.
NixOs pre-installation steps for new VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# https://nixos.org/manual/nixos/stable/index.html#sec-installation | |
############################################################### | |
# JUST DON'T USE THIS. IT'S NOT FOR YOU. | |
############################################################### | |
disk="vda" | |
parted $disk -- mklabel gpt | |
parted $disk -- mkpart primary 512MB -8GB | |
parted $disk -- mkpart primary linux-swap -8GB 100% | |
parted $disk -- mkpart ESP fat32 1MB 512MB | |
parted $disk -- set 3 esp on | |
mkfs.ext4 -L nixos ${disk}1 | |
mkswap -L swap ${disk}2 | |
mkfs.fat -F 32 -n boot ${disk}3 | |
mount /dev/disk/by-label/nixos /mnt | |
mkdir -p /mnt/boot | |
mount /dev/disk/by-label/boot /mnt/boot | |
nixos-generate-config --root /mnt | |
echo "Now edit /mnt/etc/nixos/configuration.nix to suit your needs" | |
echo "Docs https://nixos.org/manual/nixos/stable/index.html#sec-installation" | |
echo | |
echo "Once you have read the docs and are ready, run nixos-install" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment