Compare commits

..

2 Commits

Author SHA1 Message Date
Sebastian Fischer
cdb63d1114 [TASK] Allow different hdds for installation 2026-02-13 21:25:37 +01:00
Sebastian Fischer
88929f83e6 [TASK] Improve readme 2026-02-13 21:21:28 +01:00
2 changed files with 49 additions and 43 deletions

View File

@ -7,8 +7,7 @@ sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils vir
``` ```
- Video: QXL - Video: QXL
- In `configuration.nix`: `services.spice-vdagentd.enable = true;` - If the HDD for the VM is too small: `qemu-img resize nixos.qcow2 +20G`
- Falls die HDD zu klein ist: `qemu-img resize nixos.qcow2 +20G`
## Manuelle Installation (UEFI) ## Manuelle Installation (UEFI)
@ -20,7 +19,7 @@ sudo -i
# Use german keyboard layout # Use german keyboard layout
loadkeys de loadkeys de
# Short for all the stuff below !!! ONLY ON EMPTY DRIVES !!! # Short for all the stuff below !!! TAKE CARE OF THE USERDATA !!!
curl -L https://www.fischer.im/nixos/minimal-install --output install.sh curl -L https://www.fischer.im/nixos/minimal-install --output install.sh
chmod 744 ./install.sh chmod 744 ./install.sh
./install.sh ./install.sh
@ -32,7 +31,7 @@ If you don't use the installation script, you need to follow the steps 2-8
### 2. Partitionierung ### 2. Partitionierung
Das folgende Schema erstellt view Partitionen auf `/dev/sda`: The following schema creates four partitions on `/dev/sda`:
| Partition | Typ | Groesse | Mountpoint | | Partition | Typ | Groesse | Mountpoint |
|-------------|----------------|-------------------|------------| |-------------|----------------|-------------------|------------|
@ -41,26 +40,26 @@ Das folgende Schema erstellt view Partitionen auf `/dev/sda`:
| `/dev/sda3` | ext4 (Root) | Rest minus Home | `/` | | `/dev/sda3` | ext4 (Root) | Rest minus Home | `/` |
| `/dev/sda4` | ext4 (Home) | 50% des Rests | `/home` | | `/dev/sda4` | ext4 (Home) | 50% des Rests | `/home` |
**Hinweis:** Die Groessen muessen an die eigene Festplatte angepasst werden. Im Beispiel wird eine 100 GB Festplatte verwendet. **HINT:** The sizes must be adapted to your hard drive. In the example it's assumed that a 100GB drive is in use.
```bash ```bash
# GPT-Partitionstabelle erstellen # GPT-partition table
parted /dev/sda -- mklabel gpt parted /dev/sda -- mklabel gpt
# EFI-Partition (512 MB) # EFI-partition (512 MB)
parted /dev/sda -- mkpart esp fat32 1MB 512MB parted /dev/sda -- mkpart esp fat32 1MB 512MB
parted /dev/sda -- set 1 esp on parted /dev/sda -- set 1 esp on
# Swap-Partition (8 GB) # Swap-partition (8 GB)
parted /dev/sda -- mkpart swap linux-swap 512MB 8626MB parted /dev/sda -- mkpart swap linux-swap 512MB 8626MB
# Root-Partition (ca. 45 GB) # Root-partition (ca. 45 GB)
parted /dev/sda -- mkpart root ext4 8636MB 40000MB parted /dev/sda -- mkpart root ext4 8636MB 40000MB
# Home-Partition (Rest) # Home-partition (Rest)
parted /dev/sda -- mkpart home ext4 40000MB 100% parted /dev/sda -- mkpart home ext4 40000MB 100%
# Ergebnis pruefen # Check result
parted /dev/sda -- print parted /dev/sda -- print
``` ```
@ -100,28 +99,30 @@ mount /dev/disk/by-label/home /mnt/home
swapon /dev/disk/by-label/swap swapon /dev/disk/by-label/swap
``` ```
### 6. Konfiguration generieren ### 6. Generate configuration
```bash ```bash
nixos-generate-config --root /mnt nixos-generate-config --root /mnt
``` ```
Dies erzeugt zwei Dateien: This creates two files:
- `/mnt/etc/nixos/hardware-configuration.nix`erkannte Hardware und Mountpoints - `/mnt/etc/nixos/hardware-configuration.nix`detected hardware and mountpoints
- `/mnt/etc/nixos/configuration.nix`Grundkonfiguration - `/mnt/etc/nixos/configuration.nix`Base configuration
### 7. Bootloader konfigurieren ### 7. Check the detected bootloader
In `/mnt/etc/nixos/configuration.nix` sicherstellen, dass der Bootloader korrekt eingerichtet ist: Check inn `/mnt/etc/nixos/configuration.nix`, that the bootloader is configured like this:
```nix ```nix
boot.loader = { {
systemd-boot.enable = true; boot.loader = {
efi.canTouchEfiVariables = true; systemd-boot.enable = true;
}; efi.canTouchEfiVariables = true;
};
}
``` ```
### 8. System installieren ### 8. Install system
```bash ```bash
nixos-install nixos-install

View File

@ -4,46 +4,51 @@ sudo -i
loadkeys de loadkeys de
lsbkl lsblk
# Disk selection
DEFAULT_DISK="/dev/sda"
read -p "Disk to install to [${DEFAULT_DISK}]: " DISK
DISK="${DISK:-$DEFAULT_DISK}"
if [ ! -b "$DISK" ]; then
echo "Error: ${DISK} is not a valid block device."
exit 1
fi
echo "Using disk: ${DISK}"
# Partitioning # Partitioning
read -p "Create partitions table? DELETES ALL DATA! (j/N): " answer read -p "Create partitions table? DELETES ALL DATA! (j/N): " answer
if [ "$answer" = "j" ] || [ "$answer" = "J" ]; then if [ "$answer" = "j" ] || [ "$answer" = "J" ]; then
# GPT-partition table creation # GPT-partition table
parted /dev/sda -- mklabel gpt parted "${DISK}" -- mklabel gpt
# EFI-partition (512 MB) # EFI-partition (512 MB)
parted /dev/sda -- mkpart esp fat32 1MB 512MB parted "${DISK}" -- mkpart esp fat32 1MB 512MB
parted /dev/sda -- set 1 esp on parted "${DISK}" -- set 1 esp on
# Swap-partition (8 GB) # Swap-partition (8 GB)
parted /dev/sda -- mkpart swap linux-swap 512MB 8626MB parted "${DISK}" -- mkpart swap linux-swap 512MB 8626MB
# Root-partition (ca. 45 GB) # Root-partition (ca. 45 GB)
parted /dev/sda -- mkpart root ext4 8636MB 40000MB parted "${DISK}" -- mkpart root ext4 8636MB 40000MB
# Home-partition (Rest) # Home-partition (Rest)
parted /dev/sda -- mkpart home ext4 40000MB 100% parted "${DISK}" -- mkpart home ext4 40000MB 100%
fi fi
# Check results # Check results
parted /dev/sda -- print parted "${DISK}" -- print
mkfs.fat -F 32 -n boot ${DISK}1
mkswap -L swap ${DISK}2
mkfs.ext4 -L nixos ${DISK}3
# Format EFI-partition read -p "Format Home-partition? Deletes all userdata! (j/N): " answer
mkfs.fat -F 32 -n boot /dev/sda1
# Format swap-partition
mkswap -L swap /dev/sda2
# Format root-partition
mkfs.ext4 -L nixos /dev/sda3
read -p "Home-Partition formatieren? LOESCHT BENUTZERDATEN! (j/N): " answer
if [ "$answer" = "j" ] || [ "$answer" = "J" ]; then if [ "$answer" = "j" ] || [ "$answer" = "J" ]; then
# Format home-partition # Format home-partition
mkfs.ext4 -L home /dev/sda4 mkfs.ext4 -L home ${DISK}4
fi fi
@ -65,7 +70,7 @@ nixos-install
# If root password wasn't set because the installation needed to be restarted. # If root password wasn't set because the installation needed to be restarted.
read -p "Root-Passwort mit nixos-enter setzen? (j/N): " answer read -p "Set Root-password with nixos-enter? (j/N): " answer
if [ "$answer" = "j" ] || [ "$answer" = "J" ]; then if [ "$answer" = "j" ] || [ "$answer" = "J" ]; then
nixos-enter --root '/mnt' nixos-enter --root '/mnt'
passwd passwd