Skip to content

Commit bb724e3

Browse files
committed
prettier: wrap long lines
1 parent f5646c9 commit bb724e3

File tree

5 files changed

+90
-31
lines changed

5 files changed

+90
-31
lines changed

README.md

Lines changed: 74 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,86 @@
44

55
![](https://raw.githubusercontent.com/numtide/nixos-anywhere/main/docs/logo.png)
66

7-
Setting up a new machine is time-consuming, and becomes complicated when it needs to be done remotely. If you're installing NixOS, the **nixos-anywhere** (formerly known as **nixos-remote**) tool allows you to pre-configure the whole process including:
7+
Setting up a new machine is time-consuming, and becomes complicated when it
8+
needs to be done remotely. If you're installing NixOS, the **nixos-anywhere**
9+
(formerly known as **nixos-remote**) tool allows you to pre-configure the whole
10+
process including:
811

912
- Disk partitioning and formatting
1013
- Configuring and installing either NixOS or SrvOS
1114
- Installing additional files and software
1215

13-
You can then initiate an unattended installation with a single CLI command. Since **nixos-anywhere** can access the new machine using SSH, it's ideal for remote installations.
16+
You can then initiate an unattended installation with a single CLI command.
17+
Since **nixos-anywhere** can access the new machine using SSH, it's ideal for
18+
remote installations.
1419

15-
Once you have initiated the command, there is no need to 'babysit' the installation. It all happens automatically.
20+
Once you have initiated the command, there is no need to 'babysit' the
21+
installation. It all happens automatically.
1622

17-
You can use the stored configuration to repeat the same installation if you need to.
23+
You can use the stored configuration to repeat the same installation if you need
24+
to.
1825

1926
## Overview
2027

21-
If you have machines on a mix of platforms, you'll need a common installation solution that works anywhere. **nixos-anywhere** is ideal in this situation.
28+
If you have machines on a mix of platforms, you'll need a common installation
29+
solution that works anywhere. **nixos-anywhere** is ideal in this situation.
2230

23-
**nixos-anywhere** can be used equally well for cloud servers, bare metal servers such as Hetzner, and local servers accessible via a LAN. You can create standard configurations, and use the same configuration to create identical servers anywhere.
31+
**nixos-anywhere** can be used equally well for cloud servers, bare metal
32+
servers such as Hetzner, and local servers accessible via a LAN. You can create
33+
standard configurations, and use the same configuration to create identical
34+
servers anywhere.
2435

25-
You first create Nix configurations to specify partitioning, formatting and NixOS configurations. Further options can be controlled by a flake and by run-time switches.
36+
You first create Nix configurations to specify partitioning, formatting and
37+
NixOS configurations. Further options can be controlled by a flake and by
38+
run-time switches.
2639

2740
Once the configuration has been created, a single command will:
2841

2942
- Connect to the remote server via SSH
30-
- Detect whether a NixOS installer is present; if not, it will use the Linux `kexec` tool to boot into a Nixos installer.
31-
- Use the [disko](https://github.com/nix-community/disko) tool to partition and format the hard drive
43+
- Detect whether a NixOS installer is present; if not, it will use the Linux
44+
`kexec` tool to boot into a Nixos installer.
45+
- Use the [disko](https://github.com/nix-community/disko) tool to partition and
46+
format the hard drive
3247
- Install NixOS
3348
- Optionally install any Nix packages and other software required.
3449
- Optionally copy additional files to the new machine
3550

36-
It's also possible to use **nixos-anywhere** to simplify the installation on a machine that has no current operating system, first booting from a NixOS installer image. This feature is described in the [how-to guide](./docs/how_to.md#installing-on-a-machine-with-no-operating-system). It's useful because you can pre-configure your required software and preferences, and build the new machine with a single command.
51+
It's also possible to use **nixos-anywhere** to simplify the installation on a
52+
machine that has no current operating system, first booting from a NixOS
53+
installer image. This feature is described in the
54+
[how-to guide](./docs/how_to.md#installing-on-a-machine-with-no-operating-system).
55+
It's useful because you can pre-configure your required software and
56+
preferences, and build the new machine with a single command.
3757

38-
**Important Note:** Never use a production server as the target. It will be completely overwritten and all data lost. This tool should only be used for commissioning a new computer or repurposing an old machine once all important data has been migrated.
58+
**Important Note:** Never use a production server as the target. It will be
59+
completely overwritten and all data lost. This tool should only be used for
60+
commissioning a new computer or repurposing an old machine once all important
61+
data has been migrated.
3962

4063
## Prerequisites
4164

4265
- Source Machine:
4366
- - Can be any Linux machine with Nix installed, or a NixOS machine.
4467
- Target Machine:
4568

46-
- Unless you're using the option to boot from a NixOS installer image, or providing your own `kexec` image, it must be running x86-64 Linux with kexec support. Most x86_64 Linux systems do have kexec support. By providing your own [image](./docs/how_to.md#using-your-own-kexec-image) you can also perform kexec for other architectures eg aarch64
69+
- Unless you're using the option to boot from a NixOS installer image, or
70+
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/how_to.md#using-your-own-kexec-image) you can also
73+
perform kexec for other architectures eg aarch64
4774
- Must have at least 1.5 GB of RAM, excluding swap.
4875

4976
## How to use nixos-anywhere
5077

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

53-
The tool doesn't need to be installed, since it can be run directly from this repository.
81+
The tool doesn't need to be installed, since it can be run directly from this
82+
repository.
5483

55-
First create a repo that includes the disk configuration and a [flake](https://nixos.wiki/wiki/Flakes) to configure your options. This example assumes that flakes have been enabled on your source machine.
84+
First create a repo that includes the disk configuration and a
85+
[flake](https://nixos.wiki/wiki/Flakes) to configure your options. This example
86+
assumes that flakes have been enabled on your source machine.
5687

5788
Here’s an example of a simple disk configuration:
5889

@@ -104,7 +135,10 @@ Here’s an example of a simple disk configuration:
104135
}
105136
```
106137

107-
The [disko repository](https://github.com/nix-community/disko/tree/master/example) has several examples of disk configurations. You can adapt them to our own needs.
138+
The
139+
[disko repository](https://github.com/nix-community/disko/tree/master/example)
140+
has several examples of disk configurations. You can adapt them to our own
141+
needs.
108142

109143
A simple flake may look like this:
110144

@@ -149,40 +183,54 @@ A simple flake may look like this:
149183
}
150184
```
151185

152-
Once you’ve created the disk configuration and the flake, you can run the tool with a single nix command, which may look like this:
186+
Once you’ve created the disk configuration and the flake, you can run the tool
187+
with a single nix command, which may look like this:
153188

154189
```
155190
nix run github:numtide/nixos-anywhere -- --flake github:JillThornhill/flakes-example#hetzner-cloud root@135.181.254.201
156191
```
157192

158-
Note that this command references the URL of your flake, in this case github:JillThornhill/flakes-example, together with the name of the system #hetzner-cloud, as highlighted by the comment in the sample flake.
193+
Note that this command references the URL of your flake, in this case
194+
github:JillThornhill/flakes-example, together with the name of the system
195+
#hetzner-cloud, as highlighted by the comment in the sample flake.
159196

160-
The [Quickstart Guide](./docs/Quickstart.md) gives more information on how to run **nixos-anywhere** in its simplest form. For more specific instructions to suit individual requirements, see the [How To Guide](./docs/how_to.md).
197+
The [Quickstart Guide](./docs/Quickstart.md) gives more information on how to
198+
run **nixos-anywhere** in its simplest form. For more specific instructions to
199+
suit individual requirements, see the [How To Guide](./docs/how_to.md).
161200

162201
# Further Reading
163202

164-
@tfc has written a walkthrough on how use **nixos-anywhere** to bootstrap hetzner cloud servers as well as dedicated machines on his [blog](https://galowicz.de/2023/04/05/single-command-server-bootstrap/):
203+
@tfc has written a walkthrough on how use **nixos-anywhere** to bootstrap
204+
hetzner cloud servers as well as dedicated machines on his
205+
[blog](https://galowicz.de/2023/04/05/single-command-server-bootstrap/):
165206

166207
## Related Tools
167208

168-
**nixos-anywhere** makes use of the [disko](https://github.com/nix-community/disko) tool to handle the partitioning and formatting of the disks.
209+
**nixos-anywhere** makes use of the
210+
[disko](https://github.com/nix-community/disko) tool to handle the partitioning
211+
and formatting of the disks.
169212

170213
## Licensing and Contribution details
171214

172-
This software is provided free under the [MIT Licence](https://opensource.org/licenses/MIT).
215+
This software is provided free under the
216+
[MIT Licence](https://opensource.org/licenses/MIT).
173217

174-
If you would like to become a contributor, please see our [contribution guidelines.](https://github.com/numtide/docs/contribution-guidelines.md)
218+
If you would like to become a contributor, please see our
219+
[contribution guidelines.](https://github.com/numtide/docs/contribution-guidelines.md)
175220

176221
---
177222

178-
This project is supported by [Numtide](https://numtide.com/).  ![Untitledpng](https://codahosted.io/docs/6FCIMTRM0p/blobs/bl-sgSunaXYWX/077f3f9d7d76d6a228a937afa0658292584dedb5b852a8ca370b6c61dabb7872b7f617e603f1793928dc5410c74b3e77af21a89e435fa71a681a868d21fd1f599dd10a647dd855e14043979f1df7956f67c3260c0442e24b34662307204b83ea34de929d)
223+
This project is supported by [Numtide](https://numtide.com/).
224+
 ![Untitledpng](https://codahosted.io/docs/6FCIMTRM0p/blobs/bl-sgSunaXYWX/077f3f9d7d76d6a228a937afa0658292584dedb5b852a8ca370b6c61dabb7872b7f617e603f1793928dc5410c74b3e77af21a89e435fa71a681a868d21fd1f599dd10a647dd855e14043979f1df7956f67c3260c0442e24b34662307204b83ea34de929d)
179225

180-
We are a team of independent freelancers that love open source.  We help our customers make their project lifecycles more efficient by:
226+
We are a team of independent freelancers that love open source.  We help our
227+
customers make their project lifecycles more efficient by:
181228

182229
- Providing and supporting useful tools such as this one
183230
- Building and deploying infrastructure, and offering dedicated DevOps support
184231
- Building their in-house Nix skills, and integrating Nix with their workflows
185232
- Developing additional features and tools
186233
- Carrying out custom research and development.
187234

188-
[Contact us](https://numtide.com/contact) if you have a project in mind, or if you need help with any of our supported tools, including this one. We'd love to
235+
[Contact us](https://numtide.com/contact) if you have a project in mind, or if
236+
you need help with any of our supported tools, including this one. We'd love to

docs/howtos.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,17 @@ TODO: Still to be documented
1616

1717
Include:
1818

19-
`nixos-anywhere` can detect a nixos installer if it contains the identifier `VARIANT=installer` in its `/etc/os-release` file. This is the case for the nixos-unstable installer and will be also part of nixos 23.05. If an installer is detected `nixos-anywhere` will not try to kexec into its own image.
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.
2023

2124
## Using your own kexec image
2225

23-
By default `nixos-anywhere` will download the kexec image from [here](https://github.com/nix-community/nixos-images#kexec-tarballs). It is also possible to provide your own by using the command line switch `--kexec` to specify the image file. The image will then be uploaded prior to executing.
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.
2430

2531
```
2632
nixos-anywhere \
@@ -29,7 +35,9 @@ nixos-anywhere \
2935
root@yourip
3036
```
3137

32-
This is particularly useful for distributions like aarch64-linux, where there is no pre-build image. The following example assumes that your local machine can build for aarch64-linux either natively or through a remote builder
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
3341

3442
## Using nixos-anywhere without flakes
3543

docs/quickstart.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Quickstart Guide: nixos-anywhere
22

3-
This document describes how to use **nixos-anywhere** in its simplest case: installing NixOS on an existing Linux distribution via SSH.
3+
This document describes how to use **nixos-anywhere** in its simplest case:
4+
installing NixOS on an existing Linux distribution via SSH.
45

56
TODO: Populate this guide

docs/reference.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,5 @@ nix fmt
6767

6868
TODO: List actual error messages and meanings. Include:
6969

70-
If you do not have enough RAM you will see failures unpacking the initrd), this is because kexec needs to load the whole nixos into memory.
70+
If you do not have enough RAM you will see failures unpacking the initrd), this
71+
is because kexec needs to load the whole nixos into memory.

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
programs.shellcheck.enable = true;
3333
programs.shfmt.enable = true;
3434
programs.prettier.enable = true;
35+
settings.formatter.prettier.options = [ "--prose-wrap" "always" ];
3536
settings.formatter.shellcheck.options = [ "-s" "bash" ];
3637
};
3738
formatter = config.treefmt.build.wrapper;

0 commit comments

Comments
 (0)