Fix installation script
This commit is contained in:
parent
1de794889c
commit
fcc7e151f4
|
@ -8,21 +8,11 @@ partition_disk() {
|
||||||
mkfs.fat -F32 -n BOOT "$DISK"p1
|
mkfs.fat -F32 -n BOOT "$DISK"p1
|
||||||
}
|
}
|
||||||
|
|
||||||
create_directories() {
|
|
||||||
mkdir /mnt
|
|
||||||
mkdir -p /mnt/boot
|
|
||||||
mkdir -p /mnt/home/coolneng
|
|
||||||
mkdir -p /mnt/home/coolneng/Downloads
|
|
||||||
mkdir -p /mnt/nix
|
|
||||||
mkdir -p /mnt/tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
zfs_setup() {
|
zfs_setup() {
|
||||||
zpool create -f -o ashift=13 -O acltype=posixacl -O relatime=on \
|
zpool create -f -o ashift=13 -O acltype=posixacl -O relatime=on \
|
||||||
-O xattr=sa -O dnodesize=legacy -O normalization=formD -O mountpoint=none \
|
-O xattr=sa -O dnodesize=legacy -O normalization=formD -O mountpoint=none \
|
||||||
-O canmount=off -O devices=off -R /mnt -O compression=zstd -O encryption=aes-256-gcm \
|
-O canmount=off -O devices=off -R /mnt -O compression=zstd -O encryption=aes-256-gcm \
|
||||||
-O keyformat=passphrase -O keylocation=prompt syscea "$DISK"p2
|
-O keyformat=passphrase -O keylocation=prompt syscea "$DISK"p2
|
||||||
zfs create -o mountpoint=none syscea
|
|
||||||
zfs create -o mountpoint=legacy -o com.sun:auto-snapshot=false syscea/ephemeral
|
zfs create -o mountpoint=legacy -o com.sun:auto-snapshot=false syscea/ephemeral
|
||||||
zfs create -o mountpoint=legacy -o com.sun:auto-snapshot=false syscea/ephemeral/nix
|
zfs create -o mountpoint=legacy -o com.sun:auto-snapshot=false syscea/ephemeral/nix
|
||||||
zfs create -o mountpoint=legacy -o com.sun:auto-snapshot=false -o sync=disabled -o setuid=off syscea/ephemeral/tmp
|
zfs create -o mountpoint=legacy -o com.sun:auto-snapshot=false -o sync=disabled -o setuid=off syscea/ephemeral/tmp
|
||||||
|
@ -32,40 +22,28 @@ zfs_setup() {
|
||||||
zfs create -o mountpoint=legacy -o com.sun:auto-snapshot=false syscea/stateful/root
|
zfs create -o mountpoint=legacy -o com.sun:auto-snapshot=false syscea/stateful/root
|
||||||
zfs create -V 6G -b "$(getconf PAGESIZE)" -o compression=zle -o logbias=throughput -o sync=always \
|
zfs create -V 6G -b "$(getconf PAGESIZE)" -o compression=zle -o logbias=throughput -o sync=always \
|
||||||
-o primarycache=metadata -o secondarycache=none -o com.sun:auto-snapshot=false syscea/ephemeral/swap
|
-o primarycache=metadata -o secondarycache=none -o com.sun:auto-snapshot=false syscea/ephemeral/swap
|
||||||
mkswap -f /dev/zvol/syscea/swap && swapon /dev/zvol/syscea/swap
|
mkswap -f /dev/zvol/syscea/ephemeral/swap && swapon /dev/zvol/syscea/ephemeral/swap
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_datasets() {
|
mount_datasets() {
|
||||||
mount "$DISK"p1 /mnt/boot
|
|
||||||
mount -t zfs syscea/stateful/root /mnt
|
mount -t zfs syscea/stateful/root /mnt
|
||||||
|
mkdir -p /mnt/boot
|
||||||
|
mount "$DISK"p1 /mnt/boot
|
||||||
|
mkdir -p /mnt/home/coolneng
|
||||||
mount -t zfs syscea/stateful/home /mnt/home/coolneng
|
mount -t zfs syscea/stateful/home /mnt/home/coolneng
|
||||||
|
mkdir -p /mnt/home/coolneng/Downloads
|
||||||
mount -t zfs syscea/stateful/home/downloads /mnt/home/coolneng/Downloads
|
mount -t zfs syscea/stateful/home/downloads /mnt/home/coolneng/Downloads
|
||||||
|
mkdir -p /mnt/nix
|
||||||
mount -t zfs syscea/ephemeral/nix /mnt/nix
|
mount -t zfs syscea/ephemeral/nix /mnt/nix
|
||||||
|
mkdir -p /mnt/tmp
|
||||||
mount -t zfs syscea/ephemeral/tmp /mnt/tmp
|
mount -t zfs syscea/ephemeral/tmp /mnt/tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
install_system() {
|
install_system() {
|
||||||
nixos-generate-config --root /mnt
|
nixos-generate-config --root /mnt
|
||||||
nix-shell -p git nixFlakes --command "nixos-install --root /mnt --flake ."
|
sed -i "s/\${soundcloud_token}/PLACEHOLDER/" modules/audio.nix
|
||||||
passwd
|
mv /mnt/etc/nixos/hardware-configuration.nix modules/hardware-configuration.nix
|
||||||
passwd coolneng
|
nix-shell -p git nixFlakes --command "nixos-install --root /mnt --flake .#panacea"
|
||||||
}
|
|
||||||
|
|
||||||
deploy_dotfiles() {
|
|
||||||
chown -R coolneng:users /mnt/home/coolneng
|
|
||||||
git clone https://git.coolneng.duckdns.org/coolneng/dotfiles /mnt/home/coolneng/.dotfiles
|
|
||||||
git clone https://git.coolneng.duckdns.org/coolneng/doom.d /mnt/home/coolneng/.doom.d
|
|
||||||
git clone https://git.coolneng.duckdns.org/coolneng/pass /mnt/home/coolneng/.password-store
|
|
||||||
cd /mnt/home/coolneng/.dotfiles || exit
|
|
||||||
nix-shell -p stow --command "stow ."
|
|
||||||
}
|
|
||||||
|
|
||||||
restore_files() {
|
|
||||||
mkdir /tmp/iwd
|
|
||||||
scp zion:/vault/backups/panacea/iwd/iwd-networks.zip /tmp/iwd
|
|
||||||
cd /tmp/iwd || exit
|
|
||||||
unzip iwd-networks.zip
|
|
||||||
mv ./* /mnt/var/lib/iwd
|
|
||||||
}
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
|
@ -82,16 +60,10 @@ DISK="$1"
|
||||||
|
|
||||||
echo "Let's start by partitioning the disk"
|
echo "Let's start by partitioning the disk"
|
||||||
partition_disk
|
partition_disk
|
||||||
echo "Now we're creating the directories for the installation"
|
|
||||||
create_directories
|
|
||||||
echo "Starting up the ZFS machinery"
|
echo "Starting up the ZFS machinery"
|
||||||
zfs_setup
|
zfs_setup
|
||||||
echo "Mounting the horse"
|
echo "Mounting the horse"
|
||||||
mount_datasets
|
mount_datasets
|
||||||
echo "Lift off to the NixOS planet"
|
echo "Lift off to the NixOS planet"
|
||||||
install_system
|
install_system
|
||||||
echo "Adding pictures of Stallman"
|
|
||||||
deploy_dotfiles
|
|
||||||
echo "I'd just like to interject for a moment..."
|
|
||||||
restore_files
|
|
||||||
echo "All ready, time to rejoice"
|
echo "All ready, time to rejoice"
|
||||||
|
|
Loading…
Reference in New Issue