nixos-image-thinkpad-t14s-gen6/scripts/make-image.sh

31 lines
605 B
Bash
Raw Permalink Normal View History

2024-07-28 23:28:50 +00:00
#!/bin/sh -eux
file=$1
efi_part_label=i_t14sg6_efi
nix_part_label=i_t14sg6_nix
boot_size=256M
fallocate -l4G ${file}
parted ${file} mklabel gpt
parted ${file} mkpart ${efi_part_label} fat32 0% ${boot_size}
parted ${file} set 1 esp on
parted ${file} mkpart ${nix_part_label} ext3 ${boot_size} 100%
drive=$(losetup -P -f --show ${file})
mkfs.vfat -F32 ${drive}p1
mkfs.ext3 ${drive}p2
2024-07-28 23:38:23 +00:00
mkdir -p /mnt
2024-07-28 23:28:50 +00:00
mount ${drive}p2 /mnt
mkdir /mnt/boot
mount ${drive}p1 /mnt/boot
mkdir -p /mnt/etc/nixos
cp -r patches pkgs *.nix /mnt/etc/nixos/
2024-07-28 23:28:50 +00:00
nixos-install --root /mnt --no-root-password
umount -R /mnt
losetup -D