Last active
February 3, 2024 04:13
-
-
Save kanashimia/0d6f8a277b5c8948010bdc94fd923211 to your computer and use it in GitHub Desktop.
nixos unstable flake installation from nixos 20.09
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/sh | |
set -x | |
DEVICE=/dev/vda | |
SWAP_SIZE=2GiB | |
URI=github:kanashimia/nixos/module-refactor#personal-server | |
TYPE=legacy | |
trap "swapoff $DEVICE; umount /mnt/boot; umount /mnt; exit" INT | |
if [ $TYPE = legacy ]; then | |
parted $DEVICE -- mklabel msdos | |
parted $DEVICE -- mkpart primary 1MiB -$SWAP_SIZE | |
parted $DEVICE -- mkpart primary linux-swap -$SWAP_SIZE 100% | |
else | |
parted $DEVICE -- mklabel gpt | |
parted $DEVICE -- mkpart primary 512MiB -$SWAP_SIZE | |
parted $DEVICE -- mkpart primary linux-swap -$SWAP_SIZE 100% | |
parted $DEVICE -- mkpart ESP fat32 1MiB 512MiB | |
parted $DEVICE -- set 3 esp on | |
fi | |
mkfs.ext4 -L nixos ${DEVICE}1 | |
mkswap -L swap ${DEVICE}2 | |
swapon ${DEVICE}2 | |
mount /dev/disk/by-label/nixos /mnt | |
if [ $TYPE != legacy ]; then | |
mkfs.fat -F 32 -n boot ${DEVICE}3 | |
mkdir -p /mnt/boot | |
mount /dev/disk/by-label/boot /mnt/boot | |
fi | |
nix-shell -p nixFlakes --run "nixos-install --flake $URI" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment