From fcc7e151f47cdd6a14183f58ba2f07d6a6d68e00 Mon Sep 17 00:00:00 2001 From: coolneng Date: Fri, 13 Aug 2021 09:52:16 +0100 Subject: [PATCH] Fix installation script --- scripts/install.sh | 48 ++++++++++------------------------------------ 1 file changed, 10 insertions(+), 38 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index b4290af..f0ea7b2 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -8,21 +8,11 @@ partition_disk() { 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() { 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 canmount=off -O devices=off -R /mnt -O compression=zstd -O encryption=aes-256-gcm \ -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/nix 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 -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 - 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 "$DISK"p1 /mnt/boot 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 + mkdir -p /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 + mkdir -p /mnt/tmp mount -t zfs syscea/ephemeral/tmp /mnt/tmp } install_system() { nixos-generate-config --root /mnt - nix-shell -p git nixFlakes --command "nixos-install --root /mnt --flake ." - passwd - passwd coolneng -} - -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 + sed -i "s/\${soundcloud_token}/PLACEHOLDER/" modules/audio.nix + mv /mnt/etc/nixos/hardware-configuration.nix modules/hardware-configuration.nix + nix-shell -p git nixFlakes --command "nixos-install --root /mnt --flake .#panacea" } usage() { @@ -82,16 +60,10 @@ DISK="$1" echo "Let's start by partitioning the disk" partition_disk -echo "Now we're creating the directories for the installation" -create_directories echo "Starting up the ZFS machinery" zfs_setup echo "Mounting the horse" mount_datasets echo "Lift off to the NixOS planet" 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"