@@ -33,6 +33,9 @@ sbctl enroll-keys || true
3333# Detect if system contains TPM
3434TPM=$( cat /sys/class/tpm/tpm0/tpm_version_major) || TPM=" "
3535
36+ # Detect if system is booted into UEFI or Legacy
37+ [ -d /sys/firmware/efi ] && BOOT=" UEFI" || BOOT=" BIOS"
38+
3639# Perform hardware scan
3740nixos-facter -o /etc/nixos/xnode-config/hardware
3841
@@ -41,13 +44,16 @@ cp /etc/xnodeos-config-file /etc/nixos/flake.nix
4144cp /etc/xnodeos-config-lock /etc/nixos/flake.lock
4245if [[ $VERSION == " latest" ]]; then
4346 # Remove version lock
44- sed -i -e " s|\" github:Openmesh-Network/xnodeos/[^\" ]*\" |\" github:Openmesh-Network/xnodeos\" |g" ./config /flake.nix
47+ sed -i -e " s|\" github:Openmesh-Network/xnodeos/[^\" ]*\" |\" github:Openmesh-Network/xnodeos\" |g" /etc/nixos /flake.nix
4548fi
4649
4750# Apply environmental variable configuration
4851if [[ $TPM ]]; then
4952 echo -n " ${TPM} " > /etc/nixos/xnode-config/tpm
5053fi
54+ if [[ $BOOT ]]; then
55+ echo -n " ${BOOT} " > /etc/nixos/xnode-config/boot
56+ fi
5157if [[ $OWNER ]]; then
5258 echo -n " ${OWNER} " > /etc/nixos/xnode-config/owner
5359fi
@@ -83,10 +89,15 @@ sleep 1 # /dev/disk/by-label/ROOT isn't available instantly
8389mount --mkdir /dev/disk/by-label/ROOT /mnt
8490btrfs subvolume create /mnt/root
8591btrfs subvolume create /mnt/nix
92+ btrfs subvolume create /mnt/boot
8693umount /mnt
8794mount --mkdir -o lazytime,noatime,compress-force=zstd:1,subvol=root /dev/disk/by-label/ROOT /mnt
8895mount --mkdir -o lazytime,noatime,compress-force=zstd:1,subvol=nix /dev/disk/by-label/ROOT /mnt/nix
89- mount --mkdir -o umask=0077 /dev/md/BOOT /mnt/boot
96+ mount --mkdir -o lazytime,noatime,compress-force=zstd:1,subvol=boot /dev/disk/by-label/ROOT /mnt/boot
97+ for i in " ${! DISKS[@]} " ; do
98+ mount --mkdir -o umask=0077 " /dev/disk/by-partlabel/disk-disk${i} -ESP" " /mnt/boot${i} "
99+ done
100+ systemctl restart esp-sync.path
90101
91102if [[ $TPM == " 2" ]]; then
92103 # Define policy of allowed TPM2 values
132143) "
133144
134145# Boot into new OS
135- reboot
146+ if [ -z " $DEBUG " ]; then
147+ reboot
148+ fi
0 commit comments