Initial NixOS VM config
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
# NixOS Proxmox VM install script — paste into NixOS minimal ISO console
|
||||
set -euo pipefail
|
||||
|
||||
echo "=== NixOS VM Install ==="
|
||||
|
||||
# Partition disk
|
||||
parted /dev/sda -- mklabel gpt
|
||||
parted /dev/sda -- mkpart primary 512MiB -8GiB
|
||||
parted /dev/sda -- mkpart primary linux-swap -8GiB 100%
|
||||
parted /dev/sda -- mkpart ESP fat32 1MiB 512MiB
|
||||
parted /dev/sda -- set 3 esp on
|
||||
|
||||
# Format partitions
|
||||
mkfs.ext4 -L nixos /dev/sda1
|
||||
mkswap -L swap /dev/sda2
|
||||
mkfs.fat -F 32 -n boot /dev/sda3
|
||||
|
||||
# Mount
|
||||
mount /dev/disk/by-label/nixos /mnt
|
||||
mkdir -p /mnt/boot
|
||||
mount /dev/disk/by-label/boot /mnt/boot
|
||||
swapon /dev/sda2
|
||||
|
||||
# Generate hardware config
|
||||
nixos-generate-config --root /mnt
|
||||
|
||||
# Clone and use our config
|
||||
CONFIG_URL="https://gitea.klhoud.com/konrad/nixos-config-raw"
|
||||
mkdir -p /mnt/etc/nixos
|
||||
|
||||
# Option 1: If config is in a repo, clone it
|
||||
# git clone $CONFIG_URL /mnt/etc/nixos/
|
||||
# Option 2: The user will have pasted the config — placeholder below
|
||||
echo "Place your configuration.nix and flake.nix in /mnt/etc/nixos/"
|
||||
|
||||
# Generate fallback hardware config if needed
|
||||
nixos-generate-config --root /mnt --show-hardware-config > /mnt/etc/nixos/hardware-configuration.nix
|
||||
|
||||
echo "Copy your flake.nix and configuration.nix to /mnt/etc/nixos/"
|
||||
echo "then run: nixos-install --flake /mnt/etc/nixos#nixos-dev"
|
||||
Reference in New Issue
Block a user