summaryrefslogtreecommitdiffstats
path: root/README
blob: a1e59dd278aa1422167be627db789ec1485778f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Install NixOS on OCI VM.Standard.E2.1.Micro

target=INSERT_YOUR_PUBLIC_IP_HERE

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/

ssh ubuntu@$target
cd / && sudo tar xf /tmp/nixos-system-x86_64-linux.tar.xz && 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

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

nixos-install --no-root-passwd
shutdown -r now

sed -i "/^$target /d" ~/.ssh/known_hosts
ssh root@$target