Initial NixOS + Home Manager config for aspire-laptop
This commit is contained in:
47
scripts/install-from-iso.sh
Executable file
47
scripts/install-from-iso.sh
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
DISK="${DISK:-/dev/sda}"
|
||||
|
||||
echo "About to WIPE: ${DISK}"
|
||||
lsblk "${DISK}" || true
|
||||
read -r -p 'Type WIPE to continue: ' CONFIRM
|
||||
if [ "${CONFIRM}" != "WIPE" ]; then
|
||||
echo "Aborted."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wipefs -a "${DISK}"
|
||||
parted -s "${DISK}" mklabel gpt
|
||||
parted -s "${DISK}" mkpart ESP fat32 1MiB 513MiB
|
||||
parted -s "${DISK}" set 1 esp on
|
||||
parted -s "${DISK}" mkpart primary btrfs 513MiB 100%
|
||||
|
||||
EFI_PART="${DISK}1"
|
||||
ROOT_PART="${DISK}2"
|
||||
|
||||
mkfs.fat -F 32 "${EFI_PART}"
|
||||
mkfs.btrfs -f "${ROOT_PART}"
|
||||
|
||||
mount "${ROOT_PART}" /mnt
|
||||
btrfs subvolume create /mnt/@
|
||||
btrfs subvolume create /mnt/@home
|
||||
umount /mnt
|
||||
|
||||
mount -o subvol=@,compress=zstd,noatime "${ROOT_PART}" /mnt
|
||||
mkdir -p /mnt/home
|
||||
mount -o subvol=@home,compress=zstd,noatime "${ROOT_PART}" /mnt/home
|
||||
|
||||
mkdir -p /mnt/boot/efi
|
||||
mount "${EFI_PART}" /mnt/boot/efi
|
||||
|
||||
nixos-generate-config --root /mnt
|
||||
|
||||
echo
|
||||
echo "Partitioning done."
|
||||
echo "Generated /mnt/etc/nixos/hardware-configuration.nix"
|
||||
echo "Next steps:"
|
||||
echo "1) Put your flake repo at /mnt/etc/nixos (clone it there)."
|
||||
echo "2) Copy /mnt/etc/nixos/hardware-configuration.nix into:"
|
||||
echo " /mnt/etc/nixos/hosts/aspire-laptop/hardware-configuration.nix"
|
||||
echo "3) Run: nixos-install --flake /mnt/etc/nixos#aspire-laptop"
|
||||
Reference in New Issue
Block a user