|
5 | 5 | Install nix with the [DeterminateSystems nix-installer](https://github.com/DeterminateSystems/nix-installer) |
6 | 6 |
|
7 | 7 | ```shell |
8 | | -$ nix-installer plan macos --case-sensitive --extra-conf "use-case-hack = false" --encrypt true > plan.json |
9 | | -$ nix-installer install plan.json |
| 8 | +nix-installer plan macos --case-sensitive --extra-conf "use-case-hack = false" --encrypt true > plan.json |
| 9 | +nix-installer install plan.json |
10 | 10 |
|
11 | | -$ sudo mv /etc/nix/nix.conf{,.before-nix-darwin} |
12 | | -$ nix --extra-experimental-features 'flakes nix-command' run nix-darwin -- switch --flake . |
| 11 | +sudo mv /etc/nix/nix.conf{,.before-nix-darwin} |
| 12 | +nix --extra-experimental-features 'flakes nix-command' run nix-darwin -- switch --flake . |
13 | 13 | ``` |
14 | 14 |
|
15 | 15 | ## Raspberry Pi bootstrap |
16 | 16 |
|
17 | 17 | Generate SD card image |
18 | 18 |
|
19 | 19 | ```shell |
20 | | -$ task nixos:sd host=adama |
| 20 | +task nixos:sd host=adama |
21 | 21 | ``` |
22 | 22 |
|
23 | | -Flash SD card or USB stick with `sd.img` using [Raspberry Pi Imager](https://www.raspberrypi.com/software/), put in RPi and start attached to network. |
| 23 | +1. Flash SD card or USB stick with `sd.img` |
| 24 | +2. Put SD card in RPi |
| 25 | +3. Start RPi attached to network |
24 | 26 |
|
25 | 27 | Grab new ssh host key. |
26 | 28 |
|
27 | 29 | ```shell |
28 | | -$ ssh-keyscan 192.168.1.195 |
| 30 | +ssh-keyscan 192.168.1.195 |
29 | 31 | ``` |
30 | 32 |
|
31 | 33 | Update host key in `secrets/secrets.nix` and rekey secrets. |
32 | 34 |
|
33 | 35 | ```shell |
34 | | -$ cd secrets |
35 | | -$ agenix --rekey |
| 36 | +cd secrets |
| 37 | +agenix --rekey |
36 | 38 | ``` |
37 | 39 |
|
38 | 40 | Copy user secret decryption key to home dir. |
39 | 41 |
|
40 | 42 | ```shell |
41 | | -$ scp ~/.ssh/id_ed25519 adama:.ssh/ |
| 43 | +scp ~/.ssh/id_ed25519 adama:.ssh/ |
42 | 44 | ``` |
43 | 45 |
|
44 | 46 | Deploy refreshed secrets. |
45 | 47 |
|
46 | 48 | ```shell |
47 | | -$ nixos-rebuild switch --flake . --target-host 192.168.1.195 --fast --use-remote-sudo |
| 49 | +nixos-rebuild switch --flake . --target-host 192.168.1.195 --fast --use-remote-sudo |
48 | 50 | ``` |
49 | 51 |
|
50 | 52 | VM install |
51 | 53 |
|
52 | | -``` |
53 | | -$ parted /dev/sda -- mklabel gpt |
54 | | -$ parted /dev/sda -- mkpart root ext4 512MB -8GB |
55 | | -$ parted /dev/sda -- mkpart swap linux-swap -8GB 100% |
56 | | -$ parted /dev/sda -- mkpart ESP fat32 1MB 512MB |
57 | | -$ parted /dev/sda -- set 3 esp on |
58 | | -
|
59 | | -$ mkfs.ext4 -L nixos /dev/sda1 |
60 | | -$ mkswap -L swap /dev/sda2 |
61 | | -$ mkfs.fat -F 32 -n boot /dev/sda3 |
62 | | -
|
63 | | -$ mount /dev/disk/by-label/nixos /mnt |
64 | | -$ mkdir -p /mnt/boot |
65 | | -$ mount -o umask=077 /dev/disk/by-label/boot /mnt/boot |
66 | | -$ swapon /dev/sda2 |
67 | | -
|
68 | | -$ nixos-install --flake github:esselius/cfg#vm |
| 54 | +```shell |
| 55 | +parted /dev/sda -- mklabel gpt |
| 56 | +parted /dev/sda -- mkpart root ext4 512MB -8GB |
| 57 | +parted /dev/sda -- mkpart swap linux-swap -8GB 100% |
| 58 | +parted /dev/sda -- mkpart ESP fat32 1MB 512MB |
| 59 | +parted /dev/sda -- set 3 esp on |
| 60 | + |
| 61 | +mkfs.ext4 -L nixos /dev/sda1 |
| 62 | +mkswap -L swap /dev/sda2 |
| 63 | +mkfs.fat -F 32 -n boot /dev/sda3 |
| 64 | + |
| 65 | +mount /dev/disk/by-label/nixos /mnt |
| 66 | +mkdir -p /mnt/boot |
| 67 | +mount -o umask=077 /dev/disk/by-label/boot /mnt/boot |
| 68 | +swapon /dev/sda2 |
| 69 | + |
| 70 | +nixos-install --flake github:esselius/cfg#vm |
69 | 71 | ``` |
0 commit comments