Skip to content

Commit a278faa

Browse files
bors[bot]Mic92
andauthored
Merge #106
106: README: several markdown fixes r=Mic92 a=Mic92 Co-authored-by: Jörg Thalheim <joerg@thalheim.io>
2 parents 5251128 + d8d2a47 commit a278faa

File tree

3 files changed

+90
-32
lines changed

3 files changed

+90
-32
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ data has been migrated.
6868

6969
- Unless you're using the option to boot from a NixOS installer image, or
7070
providing your own `kexec` image, it must be running x86-64 Linux with kexec
71-
support. Most x86_64 Linux systems do have kexec support. By providing your
72-
own [image](./docs/howtos.md#using-your-own-kexec-image) you can also
71+
support. Most `x86_64` Linux systems do have kexec support. By providing
72+
your own [image](./docs/howtos.md#using-your-own-kexec-image) you can also
7373
perform kexec for other architectures eg aarch64
7474
- Must have at least 1.5 GB of RAM, excluding swap.
7575

7676
## How to use nixos-anywhere
7777

7878
Here’s  a quick summary of how to use **nixos-anywhere**. You can find more
79-
information in the [product documentation](./docs).
79+
information in the [documentation](./docs).
8080

8181
The tool doesn't need to be installed, since it can be run directly from this
8282
repository.
@@ -148,10 +148,10 @@ A simple flake may look like this:
148148
inputs.disko.url = github:nix-community/disko;
149149
inputs.disko.inputs.nixpkgs.follows = "nixpkgs";
150150
outputs = { self, nixpkgs, disko, ... }@attrs: {
151-
#-----------------------------------------------------------
152-
#The following line names the configuration as hetzner-cloud
153-
#This name will be referenced when nixos-remote is run
154-
#-----------------------------------------------------------
151+
#-----------------------------------------------------------
152+
# The following line names the configuration as hetzner-cloud
153+
# This name will be referenced when nixos-remote is run
154+
#-----------------------------------------------------------
155155
nixosConfigurations.hetzner-cloud = nixpkgs.lib.nixosSystem {
156156
system = "x86_64-linux";
157157
specialArgs = attrs;
@@ -171,10 +171,10 @@ A simple flake may look like this:
171171
efiInstallAsRemovable = true;
172172
};
173173
services.openssh.enable = true;
174-
#-------------------------------------------------------
175-
# Change the line below replacing <insert your key here>
176-
# with your own ssh public key
177-
#-------------------------------------------------------
174+
#-------------------------------------------------------
175+
# Change the line below replacing <insert your key here>
176+
# with your own ssh public key
177+
#-------------------------------------------------------
178178
users.users.root.openssh.authorizedKeys.keys = [ "<insert your key here>" ];
179179
})
180180
];

docs/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- [Introduction](./introduction.md)
44
- [What is nixos-anywhere?](#)
5-
- [Quickstart](#)
5+
- [Quickstart](./quickstart.md)
66
- [Getting Started](#)
77
- [System Requirements](#)
88
- [Support Matrix](#)

docs/howtos.md

Lines changed: 78 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,99 @@
88

99
[Using nixos-anywhere without flakes](#using-nixos-anywhere-without-flakes)
1010

11-
TODO: Add more topics
12-
1311
## Installing on a machine with no operating system
1412

15-
TODO: Still to be documented
13+
If your machine does not run any operating system, you can boot the standard
14+
NixOS installer using a USB or netboot. Detailed instructions on how to do this
15+
can be found in the
16+
[NixOS installation guide](https://nixos.org/manual/nixos/stable/index.html#sec-booting-from-usb).
17+
18+
When you're using `nixos-anywhere`, it will detect a NixOS installer by checking
19+
if the `/etc/os-release` file contains the identifier `VARIANT=installer`
20+
(available since NixOS 23.05). If an installer is detected, `nixos-anywhere`
21+
will not attempt to kexec into its own image. This is particularly useful for
22+
targets that do not have enough RAM for kexec or do not support kexec.
23+
24+
NixOS starts an SSH server on the installer by default, but you need to set a
25+
password in order to access it. To set a password for the `nixos` user, run the
26+
following command in a terminal on the NixOS machine:
27+
28+
```
29+
passwd
30+
```
31+
32+
If you don't know the IP address of the installer on your network, you can find
33+
it by running the following command:
34+
35+
```
36+
$ ip addr
37+
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
38+
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
39+
inet 127.0.0.1/8 scope host lo
40+
valid_lft forever preferred_lft forever
41+
inet6 ::1/128 scope host
42+
valid_lft forever preferred_lft forever
43+
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
44+
link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
45+
altname enp0s3
46+
altname ens3
47+
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic noprefixroute eth0
48+
valid_lft 86385sec preferred_lft 75585sec
49+
inet6 fec0::5054:ff:fe12:3456/64 scope site dynamic mngtmpaddr noprefixroute
50+
valid_lft 86385sec preferred_lft 14385sec
51+
inet6 fe80::5054:ff:fe12:3456/64 scope link
52+
valid_lft forever preferred_lft forever
53+
```
54+
55+
This will display the IP addresses assigned to your network interface(s),
56+
including the IP address of the installer. In the example output below, the
57+
installer's IP address is `10.0.2.15`, `fec0::5054:ff:fe12:3456`, and
58+
`fe80::5054:ff:fe12:3456%eth0`:
59+
60+
To test if you can connect and your password works, you can use the following
61+
SSH command (replace the IP address with your own):
62+
63+
```
64+
ssh -v nixos@fec0::5054:ff:fe12:3456
65+
```
1666

17-
Include:
67+
You can then use the IP address and other parameters in nixos-anywhere, like
68+
this:
1869

19-
`nixos-anywhere` can detect a nixos installer if it contains the
20-
identifier `VARIANT=installer` in its `/etc/os-release` file. This is the case
21-
for the nixos-unstable installer and will be also part of nixos 23.05. If an
22-
installer is detected `nixos-anywhere` will not try to kexec into its own image.
70+
```
71+
nixos-anywhere --flake '.#' nixos@fec0::5054:ff:fe12:3456
72+
```
2373

2474
## Using your own kexec image
2575

26-
By default `nixos-anywhere` will download the kexec image
27-
from [here](https://github.com/nix-community/nixos-images#kexec-tarballs). It is
28-
also possible to provide your own by using the command line switch `--kexec` to
29-
specify the image file. The image will then be uploaded prior to executing.
76+
By default, nixos-anywhere downloads the kexec image from the off
77+
[NixOS images repository](https://github.com/nix-community/nixos-images#kexec-tarballs).
78+
However, you can provide your own kexec image file if desired. To do this, use
79+
the `--kexec` command line switch followed by the path to your image file. The
80+
image will be uploaded prior to execution.
81+
82+
Here's an example command that demonstrates how to use a custom kexec image with
83+
`nixos-anywhere` for aarch64 instead of the default `x86_64` architecture:
3084

3185
```
3286
nixos-anywhere \
33-
--kexec "$(nix build --print-out-paths github:nix-community/nixos-images#packages.x86_64-linux.kexec-installer-noninteractive-nixos-unstable)/nixos-kexec-installer-noninteractive-x86_64-linux.tar.gz" \
87+
--kexec "$(nix build --print-out-paths github:nix-community/nixos-images#packages.aarch64-linux.kexec-installer-noninteractive-nixos-unstable)/nixos-kexec-installer-noninteractive-aarch64-linux.tar.gz" \
3488
--flake 'github:your-user/your-repo#your-system' \
3589
root@yourip
3690
```
3791

38-
This is particularly useful for distributions like aarch64-linux, where there is
39-
no pre-build image. The following example assumes that your local machine can
40-
build for aarch64-linux either natively or through a remote builder
92+
Make sure to replace `github:your-user/your-repo#your-system` with the
93+
appropriate Flake URL representing your NixOS configuration.
4194

42-
## Using nixos-anywhere without flakes
95+
This is particularly useful for architectures other than `x86_64`, where there
96+
is no pre-build image.
4397

44-
TODO: Add content
45-
46-
```
98+
The example above assumes that your local machine can build for aarch64 either
99+
natively, through a remote builder or by emulating the architecture with qemu
100+
with the following NixOS configuration:
47101

102+
```nix
103+
{
104+
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
105+
}
48106
```

0 commit comments

Comments
 (0)