From 28394efc2cfccb246910f57e378f0e9fe9759ea4 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 19 Feb 2021 17:00:13 +0000 Subject: [PATCH] machines: porthos: add installation script This is mostly to reference the installation process when looking back, rather than explicitly be able re-install this exect configuration. --- machines/porthos/install.sh | 55 +++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 machines/porthos/install.sh diff --git a/machines/porthos/install.sh b/machines/porthos/install.sh new file mode 100644 index 0000000..44ea787 --- /dev/null +++ b/machines/porthos/install.sh @@ -0,0 +1,55 @@ +#!/bin/sh + +SWAP_SIZE=16GiB + +parted /dev/sda --script -- \ + mklabel msdos \ + mkpart primary 512MiB -$SWAP_SIZE \ + mkpart primary linux-swap -$SWAP_SIZE 100% \ + mkpart ESP fat32 1MiB 512MiB \ + set 3 esp on + +parted /dev/sdb --script -- \ + mklabel gpt \ + mkpart primary 0MiB 100% + +mkfs.ext4 -L media1 /dev/sda1 +mkfs.ext4 -L media2 /dev/sdb1 + +pvcreate /dev/sda1 +pvcreate /dev/sdb1 +vgcreate lvm /dev/sda1 /dev/sdb1 +lvcreate -l 100%FREE -n media lvm + +mkfs.ext4 -L nixos /dev/mapper/lvm-media +mkswap -L swap /dev/sda2 +mkfs.fat -F 32 -n boot /dev/sda3 + +mount /dev/disk/by-label/nixos /mnt +swapon /dev/sda2 + +apt install sudo +useradd -m -G sudo setupuser +su setupuser + +cat << EOF +# Run the following commands as setup user +curl -L https://nixos.org/nix/install | sh +. $HOME/.nix-profile/etc/profile.d/nix.sh +nix-channel --add https://nixos.org/channels/nixos-20.09 nixpkgs +sudo `which nixos-generate-config` --root /mnt + +# Change uuids to labels +vim /mnt/etc/nixos/hardware-configuration.nix + +# Install system +mkdir -p /mnt/home/ambroisie/git/nix/config +cd /mnt/home/ambroisie/git/nix/config + +nix-env -iA nixos.git nixos.nixFlakes nixos.git-crypt +git clone . +# Assuming you set up GPG key correctly +git crypt unlock + +nixos-install --root /mnt --flake '.#' +EOF