2
2
3
3
<img src =" https://raw.githubusercontent.com/numtide/nixos-anywhere/5bdd3f3c442b923813e301b319290305353a3e7a/docs/logo.png " width =" 256 " height =" 256 " >
4
4
5
- nixos-anywhere (formally known as nixos-remote) makes it possible to install nixos from Linux machines reachable via ssh.
6
- Under the hood uses a [ kexec image] ( https://github.com/nix-community/nixos-images#kexec-tarballs ) to boot
7
- into a NixOS installer from a running Linux system.
8
- It then uses [ disko] ( https://github.com/nix-community/disko ) to partition and
9
- format the disks on the target system before it installs the user provided nixos
5
+ nixos-anywhere (formally known as nixos-remote) makes it possible to install
6
+ nixos from Linux machines reachable via ssh. Under the hood uses a
7
+ [ kexec image] ( https://github.com/nix-community/nixos-images#kexec-tarballs ) to
8
+ boot into a NixOS installer from a running Linux system. It then uses
9
+ [ disko] ( https://github.com/nix-community/disko ) to partition and format the
10
+ disks on the target system before it installs the user provided nixos
10
11
configuration.
11
12
12
13
## Requirements
13
14
14
- - x86_64 Linux system with kexec support (most x86_64 machine do have kexec support)
15
+ ` nixos-remote ` can detect nixos installer if those contain the identifier
16
+ ` VARIANT=installer ` in their ` /etc/os-release ` file. This is the case for the
17
+ nixos-unstable installer and will be also part of nixos 23.05. If installer is
18
+ detected ` nixos-remote ` will not try to kexec into its own image.
19
+
20
+ If your system is not booted into a nixos installer than the following
21
+ requirements apply for kexec to succeed:
22
+
23
+ - x86_64 Linux system with kexec support (most x86_64 machine do have kexec
24
+ support) or you have to provide your own
25
+ [ image] ( https://github.com/numtide/nixos-anywhere#using-your-own-kexec-image )
15
26
- At least 2.5GB RAM (swap does not count). If you do not have enough RAM you
16
27
will see failures unpacking the initrd), this is because kexec needs to load
17
28
the whole nixos into memory.
18
29
19
30
## Usage
20
- Needs a repo with your configurations with flakes. For a minimal example checkout https://github.com/numtide/nixos-anywhere-examples .
21
31
22
- Your NixOS configuration will also need a [ disko] ( https://github.com/nix-community/disko ) configuration as we can see in
23
- our [ example] ( https://github.com/numtide/nixos-anywhere-examples/blob/9768e438b1467ec55d42e096860e7199bd1ef43d/flake.nix#L15-L19 )
32
+ Needs a repo with your configurations with flakes. For a minimal example
33
+ checkout https://github.com/numtide/nixos-anywhere-examples .
34
+
35
+ Your NixOS configuration will also need a
36
+ [ disko] ( https://github.com/nix-community/disko ) configuration as we can see in
37
+ our
38
+ [ example] ( https://github.com/numtide/nixos-anywhere-examples/blob/9768e438b1467ec55d42e096860e7199bd1ef43d/flake.nix#L15-L19 )
24
39
25
40
Afterwards you can just run:
26
41
@@ -32,7 +47,8 @@ The parameter passed to `--flake` should point to your nixos configuration
32
47
exposed in your flake (` nixosConfigurations.your-system ` in the example above).
33
48
34
49
` nixos-anywhere --help `
35
- ``` shell
50
+
51
+ ``` shell
36
52
Usage: nixos-anywhere [options] ssh-host
37
53
38
54
Options:
@@ -67,21 +83,23 @@ Options:
67
83
68
84
# # Using your own kexec image
69
85
70
- By default ` nixos-anywhere` will download the kexec image from [here](https://github.com/nix-community/nixos-images#kexec-tarballs).
71
- It is also possible to provide your own by providing a file to ` --kexec` . The image will than uploaded prior to executing.
86
+ By default ` nixos-anywhere` will download the kexec image from
87
+ [here](https://github.com/nix-community/nixos-images#kexec-tarballs). It is also
88
+ possible to provide your own by providing a file to ` --kexec` . The image will
89
+ than uploaded prior to executing.
72
90
73
- ` ` ` shell
91
+ ` ` ` shell
74
92
nixos-anywhere \
75
93
--kexec " $( nix build --print-out-paths github:nix-community/nixos-images#packages.x86_64-linux.kexec-installer-nixos-unstable) /nixos-kexec-installer-x86_64-linux.tar.gz" \
76
94
--flake ' github:your-user/your-repo#your-system' \
77
95
root@yourip
78
96
` ` `
79
97
80
98
` --kexec` can be useful for example for aarch64-linux, where there is no
81
- pre-build image. The following example assumes that your local machine can
82
- build for aarch64-linux either natively or through a remote builder
99
+ pre-build image. The following example assumes that your local machine can build
100
+ for aarch64-linux either natively or through a remote builder
83
101
84
- ` ` ` shell
102
+ ` ` ` shell
85
103
nixos-anywhere \
86
104
--kexec " $( nix build --print-out-paths github:nix-community/nixos-images#packages.aarch64-linux.kexec-installer-nixos-unstable) /nixos-kexec-installer-aarch64-linux.tar.gz" \
87
105
--flake ' your-flake#your-system' \
0 commit comments