remove mini, reinstall that as OpenBSD test machine puffy
This commit is contained in:
parent
5b105a9fa4
commit
758337b75f
3 changed files with 0 additions and 168 deletions
|
@ -1,18 +0,0 @@
|
||||||
{ config, pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports =
|
|
||||||
[
|
|
||||||
# Include the results of the hardware scan.
|
|
||||||
./hardware-configuration.nix
|
|
||||||
|
|
||||||
# Shared config of all machines
|
|
||||||
/data/nixos/share/common.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
# our hostname
|
|
||||||
networking.hostName = "mini";
|
|
||||||
|
|
||||||
# EurKey layout
|
|
||||||
services.xserver.xkb.layout = "eu";
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
|
||||||
|
|
||||||
# basic drivers
|
|
||||||
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "sd_mod" ];
|
|
||||||
|
|
||||||
# AMD CPU
|
|
||||||
boot.kernelModules = [ "kvm-amd" ];
|
|
||||||
hardware.cpu.amd.updateMicrocode = true;
|
|
||||||
|
|
||||||
# AMD graphics
|
|
||||||
boot.initrd.kernelModules = [ "amdgpu" ];
|
|
||||||
services.ollama.acceleration = "rocm";
|
|
||||||
|
|
||||||
# /boot efi partition to boot in UEFI mode
|
|
||||||
fileSystems."/boot" = {
|
|
||||||
device = "/dev/disk/by-id/nvme-CT4000P3PSSD8_2325E6E63746-part1";
|
|
||||||
fsType = "vfat";
|
|
||||||
neededForBoot = true;
|
|
||||||
options = [ "fmask=0022" "dmask=0022" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
# /nix volume with the system & all persistent data
|
|
||||||
fileSystems."/nix" = {
|
|
||||||
device = "/dev/disk/by-id/nvme-CT4000P3PSSD8_2325E6E63746-part2:/dev/disk/by-id/ata-CT2000MX500SSD1_2138E5D5061F-part2";
|
|
||||||
fsType = "bcachefs";
|
|
||||||
neededForBoot = true;
|
|
||||||
};
|
|
||||||
}
|
|
119
mini/install.txt
119
mini/install.txt
|
@ -1,119 +0,0 @@
|
||||||
#
|
|
||||||
# enable ssh for root
|
|
||||||
#
|
|
||||||
|
|
||||||
sudo bash
|
|
||||||
systemctl start sshd
|
|
||||||
passwd
|
|
||||||
|
|
||||||
#
|
|
||||||
# install script below
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# kill old efi boot stuff
|
|
||||||
#
|
|
||||||
|
|
||||||
efibootmgr
|
|
||||||
efibootmgr -b 0 -B
|
|
||||||
efibootmgr -b 1 -B
|
|
||||||
efibootmgr -b 2 -B
|
|
||||||
efibootmgr -b 3 -B
|
|
||||||
efibootmgr -b 4 -B
|
|
||||||
efibootmgr
|
|
||||||
|
|
||||||
# host name to use
|
|
||||||
HOST=mini
|
|
||||||
|
|
||||||
# disks to use
|
|
||||||
DISK=/dev/disk/by-id/nvme-CT4000P3PSSD8_2325E6E63746
|
|
||||||
DISK2=/dev/disk/by-id/ata-CT2000MX500SSD1_2138E5D5061F
|
|
||||||
DISKS="$DISK $DISK2"
|
|
||||||
|
|
||||||
# ensure 4k sector size
|
|
||||||
nvme format --lbaf=1 --force $DISK
|
|
||||||
nvme id-ns -H $DISK
|
|
||||||
sleep 5
|
|
||||||
|
|
||||||
# create partition table on all disks and EFI partition
|
|
||||||
RAID=""
|
|
||||||
for D in $DISKS; do
|
|
||||||
# kill old data
|
|
||||||
sgdisk --zap-all $D
|
|
||||||
blkdiscard -v -f $D
|
|
||||||
wipefs -a $D
|
|
||||||
sleep 5
|
|
||||||
|
|
||||||
# Create partition table
|
|
||||||
parted $D -- mklabel gpt
|
|
||||||
|
|
||||||
# Create a /boot as $D-part1
|
|
||||||
parted $D -- mkpart ESP fat32 1MiB 1024MiB
|
|
||||||
parted $D -- set 1 boot on
|
|
||||||
|
|
||||||
# Create a /nix as $D-part2
|
|
||||||
parted $D -- mkpart NIX 1024MiB 100%
|
|
||||||
|
|
||||||
# boot partition after short sleep, needed on some machines
|
|
||||||
sleep 5
|
|
||||||
mkfs.vfat $D-part1
|
|
||||||
|
|
||||||
# add part2 to raid
|
|
||||||
RAID="$RAID $D-part2"
|
|
||||||
done
|
|
||||||
|
|
||||||
# take a look at the partitions
|
|
||||||
lsblk
|
|
||||||
|
|
||||||
# create encrypted bcachefs
|
|
||||||
bcachefs format --encrypt -f $RAID
|
|
||||||
nix-env -iA nixos.keyutils
|
|
||||||
keyctl link @u @s
|
|
||||||
bcachefs unlock $DISK-part2
|
|
||||||
|
|
||||||
# prepare install, tmpfs root
|
|
||||||
mount -t tmpfs none /mnt
|
|
||||||
|
|
||||||
# Create directories to mount file systems on
|
|
||||||
mkdir -p /mnt/{data,nix,boot,root,etc/nixos}
|
|
||||||
|
|
||||||
# mount the ESP
|
|
||||||
mount $DISK-part1 /mnt/boot
|
|
||||||
|
|
||||||
# mount the /nix
|
|
||||||
mount -t bcachefs $DISK-part2 /mnt/nix
|
|
||||||
|
|
||||||
# mount the /data via bind mount
|
|
||||||
mkdir /mnt/nix/data
|
|
||||||
mount --bind /mnt/nix/data /mnt/data
|
|
||||||
|
|
||||||
# bind mount persistent stuff to data
|
|
||||||
mkdir -p /mnt/data/{root,nixos/$HOST}
|
|
||||||
mount --bind /mnt/data/root /mnt/root
|
|
||||||
mount --bind /mnt/data/nixos/$HOST /mnt/etc/nixos
|
|
||||||
|
|
||||||
# create fake /data to have the right paths
|
|
||||||
mkdir -p /data
|
|
||||||
mount --bind /mnt/data /data
|
|
||||||
|
|
||||||
# take a look
|
|
||||||
mount
|
|
||||||
|
|
||||||
# configure
|
|
||||||
nixos-generate-config --root /mnt
|
|
||||||
|
|
||||||
# copy config data from another machine including secrets
|
|
||||||
doas scp -r /data/nixos root@192.168.13.100:/mnt/data
|
|
||||||
|
|
||||||
# install
|
|
||||||
nixos-install --option experimental-features 'nix-command flakes' --no-root-passwd --root /mnt
|
|
||||||
|
|
||||||
# unmount all stuff and sync
|
|
||||||
umount -Rl /data /mnt
|
|
||||||
sync
|
|
||||||
|
|
||||||
# shutdown once
|
|
||||||
shutdown now
|
|
||||||
|
|
||||||
# sync all /data after the install
|
|
||||||
doas rsync -va --delete --one-file-system /data/ root@192.168.13.100:/data/
|
|
Loading…
Add table
Add a link
Reference in a new issue