This commit is contained in:
zimbatm 2023-05-29 14:54:03 +02:00
parent 3166275d2f
commit 0d2bc43dd6
7 changed files with 57 additions and 35 deletions

View File

@ -71,7 +71,7 @@ data has been migrated.
- - Can be any Linux machine with Nix installed, or a NixOS machine.
- Target Machine:
- 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

View File

@ -1,6 +1,6 @@
# Table of Content: - nixos-anywhere
***Install NixOS everywhere via ssh***
**_Install NixOS everywhere via ssh_**
<img title="" src="https://raw.githubusercontent.com/numtide/nixos-anywhere/main/docs/logo.png" alt="" width="149">

View File

@ -1,6 +1,6 @@
# How To Guide: nixos-anywhere
***Install NixOS everywhere via ssh***
**_Install NixOS everywhere via ssh_**
<img title="" src="https://raw.githubusercontent.com/numtide/nixos-anywhere/main/docs/logo.png" alt="" width="129">
@ -16,13 +16,23 @@
## Installing on a machine with no operating system
If your machine doesn't currently have an operating system installed, you still run `nixos-anywhere` remotely to automate the install. To do this, you would first need to boot the target machine from the standard NixOS installer. You can either boot from a USB or use `netboot`.
If your machine doesn't currently have an operating system installed, you still
run `nixos-anywhere` remotely to automate the install. To do this, you would
first need to boot the target machine from the standard NixOS installer. You can
either boot from a USB or use `netboot`.
The [NixOS installation guide](https://nixos.org/manual/nixos/stable/index.html#sec-booting-from-usb) has detailed instructions on how to boot the installer.
The
[NixOS installation guide](https://nixos.org/manual/nixos/stable/index.html#sec-booting-from-usb)
has detailed instructions on how to boot the installer.
When you run `nixos-anywhere`, it will determine whether a NixOS installer is present by checking whether the `/etc/os-release` file contains the identifier `VARIANT=installer`. This identifier is available on releases NixOS 23.05 or later.
When you run `nixos-anywhere`, it will determine whether a NixOS installer is
present by checking whether the `/etc/os-release` file contains the identifier
`VARIANT=installer`. This identifier is available on releases NixOS 23.05 or
later.
If an installer is detected, `nixos-anywhere`will not attempt to `kexec` into its own image. This is particularly useful for targets that don't have enough RAM for `kexec` or don't support `kexec`.
If an installer is detected, `nixos-anywhere`will not attempt to `kexec` into
its own image. This is particularly useful for targets that don't have enough
RAM for `kexec` or don't support `kexec`.
NixOS starts an SSH server on the installer by default, but you need to set a
password in order to access it. To set a password for the `nixos` user, run the
@ -57,7 +67,7 @@ $ ip addr
This will display the IP addresses assigned to your network interface(s),
including the IP address of the installer. In the example output below, the
installer's IP addresses are `10.0.2.15`, `fec0::5054:ff:fe12:3456`, and
installer's IP addresses are `10.0.2.15`, `fec0::5054:ff:fe12:3456`, and
`fe80::5054:ff:fe12:3456%eth0`:
To test if you can connect and your password works, you can use the following
@ -73,18 +83,23 @@ You can then use the IP address to run `nixos-anywhere` like this:
nix run github:numtide/nixos-anywhere -- --flake '.#myconfig' nixos@fec0::5054:ff:fe12:3456
```
This example assumes a flake in the curent directory containing a configuration named `myconfig`.
This example assumes a flake in the curent directory containing a configuration
named `myconfig`.
## Using your own kexec image
By default, `nixos-anywhere` downloads the kexec image from the [NixOS images repository](https://github.com/nix-community/nixos-images#kexec-tarballs).
By default, `nixos-anywhere` downloads the kexec image from the
[NixOS images repository](https://github.com/nix-community/nixos-images#kexec-tarballs).
However, you can provide your own `kexec` image file if you need to use a
different one. This is particularly useful for architectures other than
`x86_64`, since they don't have a pre-build image.
However, you can provide your own `kexec` image file if you need to use a different one. This is particularly useful for architectures other than `x86_64`, since they don't have a pre-build image.
To do this, use the `--kexec` command line switch followed by the path to your
image file. The image will be uploaded prior to execution.
To do this, use the `--kexec` command line switch followed by the path to your image file. The image will be uploaded prior to execution.
Here's an example command that demonstrates how to use a custom kexec image with `nixos-anywhere` for aarch64 instead of the default `x86_64` architecture:
Here's an example command that demonstrates how to use a custom kexec image with
`nixos-anywhere` for aarch64 instead of the default `x86_64` architecture:
```
nix run github:numtide/nixos-anywhere -- \
@ -96,15 +111,15 @@ nix run github:numtide/nixos-anywhere -- \
Make sure to replace `github:your-user/your-repo#your-system` with the
appropriate Flake URL representing your NixOS configuration.
The example above assumes that your local machine can build for aarch64 in one
of the following ways:
The example above assumes that your local machine can build for aarch64 in one of the following ways:
- Natively
- Natively
- Through a remote builder
- By emulating the architecture with qemu using the following NixOS configuration:
- By emulating the architecture with qemu using the following NixOS
configuration:
```nix
{

View File

@ -64,8 +64,8 @@ NixOS has been installed.
[here](https://github.com/numtide/nixos-anywhere-examples/blob/main/disk-config.nix).
This configures a standard GPT (GUID Partition Table) partition compatible
with both EFI and BIOS systems, and mounts the disk as `/dev/sda`. If this
doesnt meet your requirements, choose an example that suits your disk
layout from the
doesnt meet your requirements, choose an example that suits your disk layout
from the
[disko examples](https://github.com/nix-community/disko/tree/master/example).
For more information about this configuration, refer to the
[disko documentation.](https://github.com/nix-community/disko)
@ -85,15 +85,15 @@ example uses a local directory on the source machine.
6. You can now run **nixos-anywhere** from the command line as shown below,
where:
- `<path to configuration>` is the path to the directory or repository
containing `flake.nix` and `disk-config.nix`
- `<configuration name>` must match the name that immediately follows the
text `nixosConfigurations.` in the flake, as indicated by the comment in
the
[example](https://github.com/numtide/nixos-anywhere-examples/blob/main/flake.nix)).
- `<ip address>` is the IP address of the target machine.
```

View File

@ -1,6 +1,6 @@
# Reference Manual: nixos-anywhere
***Install NixOS everywhere via ssh***
**_Install NixOS everywhere via ssh_**
<img title="" src="https://raw.githubusercontent.com/numtide/nixos-anywhere/main/docs/logo.png" alt="" width="141">
@ -59,11 +59,14 @@ Options:
TODO: Add additional error messages and meanings. Fill in missing explanations
This section lists known error messages and their explanations. Some explanations may refer to the following CLI syntax:
This section lists known error messages and their explanations. Some
explanations may refer to the following CLI syntax:
`nix run github:numtide/nixos-anywhere -- --flake <path to configuration>#<configuration name> root@<ip address>`
This list is not comprehensive. It's possible you may encounter errors that originate from the underlying operating system. These should be documented in the relevant operating system manual.
This list is not comprehensive. It's possible you may encounter errors that
originate from the underlying operating system. These should be documented in
the relevant operating system manual.
| Id | Message | Explanation |
| --- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

View File

@ -4,14 +4,17 @@
<img src="https://raw.githubusercontent.com/numtide/nixos-anywhere/main/docs/logo.png" width="150" height="150">
[Documentation Index](./INDEX.md)
[Documentation Index](./INDEX.md)
## Requirements
- Source Machine:
- Can be any Linux or Mac computer with Nix installed, or a NixOS machine.
- Destination Machine:
- Must be an x86-64 machine unless you are able to supply a `kexec` image for your CPU type.
- If you're not using the option to boot from a Nixos installer image, it must:
- Be running x86-64 Linux with kexec support . Most x86_64 Linux systems do have kexec support.
- Must be an x86-64 machine unless you are able to supply a `kexec` image for
your CPU type.
- If you're not using the option to boot from a Nixos installer image, it
must:
- Be running x86-64 Linux with kexec support . Most x86_64 Linux systems do
have kexec support.
- Have at least 2.5 GB of RAM, excluding swap.

View File

@ -8,13 +8,14 @@
## List of tested environments
We have verified that **nixos-anywhere** runs successfully on the environments listed below.
We have verified that **nixos-anywhere** runs successfully on the environments
listed below.
**kexec boot:**    Indicates whether it can work by using a kexec boot
**Image boot:** Indicates whether it can work if booted from a NixOS installer
**Image boot:** Indicates whether it can work if booted from a NixOS installer
**Own kexec:**     Indicates whether it can work if you supply your own kexec
**Own kexec:**     Indicates whether it can work if you supply your own kexec
| **Platform** | **Operating System** | kexec boot | Image boot | Own kexec |
| ------------- | -------------------- | ---------- | ---------- | --------- |
@ -26,4 +27,4 @@ We have verified that **nixos-anywhere** runs successfully on the environments l
| | | | | |
| | | | | |
##
##