diff options
author | tv <tv@krebsco.de> | 2023-07-03 14:09:55 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2023-07-03 14:09:55 +0200 |
commit | 1bb3936251c3854cfa2e533f8bbec7cdf7865c20 (patch) | |
tree | 568d02fbee07f19475b8a076c0535d62bc7d41df /README | |
parent | 729f055c3d2a13eb088104ae68a2619e2a7632f1 (diff) |
README: add support for aarch64
Diffstat (limited to 'README')
-rw-r--r-- | README | 42 |
1 files changed, 30 insertions, 12 deletions
@@ -1,31 +1,49 @@ -# Install NixOS on OCI VM.Standard.E2.1.Micro +# Install NixOS on OCI +# The hostname of the to-be-installed machine. +# It's used to select the configuration. +name=example + +# The IP address or domain name of the to-be-installed machine. target=INSERT_YOUR_PUBLIC_IP_HERE +# The machine hardware name of the target machine. +# Supported values: aarch64, x86_64 +machine=aarch64 + kexec_tarball=$(nix-build --no-out-link '<nixpkgs/nixos>' -A config.system.build.kexec_tarball -I nixos-config=./kexec.nix) -scp $kexec_tarball/tarball/nixos-system-x86_64-linux.tar.xz ubuntu@$target:/tmp/ +scp $kexec_tarball/tarball/nixos-system-$machine-linux.tar.xz ubuntu@$target:/tmp/ -ssh ubuntu@$target -cd / && sudo tar xf /tmp/nixos-system-x86_64-linux.tar.xz && sudo /kexec_nixos +ssh ubuntu@$target sudo tar -C / -xf /tmp/nixos-system-$machine-linux.tar.xz +ssh ubuntu@$target sudo /kexec_nixos sed -i "/^$target /d" ~/.ssh/known_hosts ssh root@$target -printf '%s\n' label:gpt ,512M,U ,4G,S ,,L | sfdisk /dev/sda -mkfs.fat -F 32 -n boot /dev/sda1 -mkswap -L swap /dev/sda2 -mkfs.ext4 -L root /dev/sda3 +# If the VM doesn't have enough memory, add a swap device and +# increase the size of the kexec's Nix store. +if test "$(free -m | awk '/^Mem:/{print$2}')" -lt 1024; then + printf '%s\n' label:gpt ,512M,U ,4G,S ,,L | sfdisk /dev/sda + mkfs.fat -F 32 -n boot /dev/sda1 + mkswap -L swap /dev/sda2 + mkfs.ext4 -L root /dev/sda3 + swapon /dev/disk/by-label/swap + mount -o remount,size=800M /nix/.rw-store/ +else + printf '%s\n' label:gpt ,512M,U ,,L | sfdisk /dev/sda + mkfs.fat -F 32 -n boot /dev/sda1 + mkfs.ext4 -L root /dev/sda2 +fi mkdir -m 0000 -p /mnt && mount /dev/disk/by-label/root /mnt mkdir -m 0000 -p /mnt/boot && mount /dev/disk/by-label/boot /mnt/boot -swapon /dev/disk/by-label/swap - -mount -o remount,size=800M /nix/.rw-store/ nix-channel --add https://nixos.org/channels/nixos-23.05 nixpkgs nix-channel --update -scp config.nix root@$target:/mnt/etc/nixos/configuration.nix +ssh root@$target mkdir -p /mnt/etc/nixos + +scp "$name"/config.nix root@$target:/mnt/etc/nixos/configuration.nix nixos-install --no-root-passwd shutdown -r now |