Skip to content

Commit 4f4eefd

Browse files
committed
docs(no-os): add local installation instructions
- Remind user to connect to WiFi. - Add local install section. - Remind to add experimental features to CLI. - Name the remote install section. - Add `--build-on remote`, and explain it, or most likely the live system will run out of disk space (which is actually RAM at that moment). @moduon MT-9339
1 parent 76b6890 commit 4f4eefd

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

docs/howtos/no-os.md

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,41 @@ If an installer is detected, `nixos-anywhere` will not attempt to `kexec` into
1818
its own image. This is particularly useful for targets that don't have enough
1919
RAM for `kexec` or don't support `kexec`.
2020

21+
Often you will need some kind of network connectivity before installing NixOS.
22+
Use the live system to connect to some network.
23+
2124
NixOS starts an SSH server on the installer by default, but you need to set a
2225
password in order to access it. To set a password for the `nixos` user, run the
2326
following command in a terminal on the NixOS machine:
2427

25-
```
28+
```shell
2629
passwd
2730
```
2831

29-
If you don't know the IP address of the installer on your network, you can find
32+
## Local installation
33+
34+
If your source and target machines are the same (the one booted from USB), you
35+
can install NixOS by running `nixos-anywhere` like this:
36+
37+
```shell
38+
# Set your flake URL
39+
flake='github:nix-community/nixos-anywhere-examples#generic'
40+
41+
# Install it
42+
nix --extra-experimental-features 'nix-command flakes' run github:nix-community/nixos-anywhere -- --flake "$flake" --target-host nixos@localhost --build-on remote
43+
```
44+
45+
In this kind of installation, the flag `--build-on remote` makes sure the build
46+
is done after partitioning and mounting `/nix`. Otherwise, it would be prebuilt
47+
in the live system, which could then run out of space quickly.
48+
49+
## Remote installation
50+
51+
If your source and target machines are different (for example, you want to
52+
install a new laptop, but the flake is in another laptop), both will have to
53+
connect. This is commonly done by connecting both to the same local network.
54+
55+
If you don't know the IP address of the target machine on your network, you can find
3056
it by running the following command:
3157

3258
```
@@ -57,15 +83,15 @@ installer's IP addresses are `10.0.2.15`, `fec0::5054:ff:fe12:3456`, and
5783
To test if you can connect and your password works, you can use the following
5884
SSH command (replace the IP address with your own):
5985

60-
```
86+
```shell
6187
ssh -v nixos@fec0::5054:ff:fe12:3456
6288
```
6389

6490
You can then use the IP address to run `nixos-anywhere` like this:
6591

66-
```
92+
```shell
6793
nix run github:nix-community/nixos-anywhere -- --flake '.#myconfig' --target-host nixos@fec0::5054:ff:fe12:3456
6894
```
6995

7096
This example assumes a flake in the current directory containing a configuration
71-
named `myconfig`.
97+
named `myconfig`.

0 commit comments

Comments
 (0)