11# CLI
22
3+ <!-- `$ nix run . -- --help` -->
4+
35```
46Usage: nixos-anywhere [options] [<ssh-host>]
57
68Options:
79
810* -f, --flake <flake_uri>
9- set the flake to install the system from.
11+ set the flake to install the system from. i.e.
12+ nixos-anywhere --flake .#mymachine
13+ Also supports variants:
14+ nixos-anywhere --flake .#nixosConfigurations.mymachine.config.virtualisation.vmVariant
1015* --target-host <ssh-host>
11- specified the SSH target host to deploy onto.
16+ set the SSH target host to deploy onto.
1217* -i <identity_file>
1318 selects which SSH private key file to use.
1419* -p, --ssh-port <ssh_port>
@@ -24,8 +29,6 @@ Options:
2429* -s, --store-paths <disko-script> <nixos-system>
2530 set the store paths to the disko-script and nixos-system directly
2631 if this is given, flake is not needed
27- * --no-reboot
28- do not reboot after installation, allowing further customization of the target installation.
2932* --kexec <path>
3033 use another kexec tarball to bootstrap NixOS
3134* --kexec-extra-flags
@@ -36,18 +39,24 @@ Options:
3639 after kexec is executed, use a custom ssh port to connect. Defaults to 22
3740* --copy-host-keys
3841 copy over existing /etc/ssh/ssh_host_* host keys to the installation
39- * --stop-after-disko
40- exit after disko formatting, you can then proceed to install manually or some other way
4142* --extra-files <path>
4243 contents of local <path> are recursively copied to the root (/) of the new NixOS installation. Existing files are overwritten
43- Copied files will be owned by root. See documentation for details.
44+ Copied files will be owned by root unless specified by --chown option. See documentation for details.
45+ * --chown <path> <ownership>
46+ change ownership of <path> recursively. Recommended to use uid:gid as opposed to username:groupname for ownership.
47+ Option can be specified more than once.
4448* --disk-encryption-keys <remote_path> <local_path>
4549 copy the contents of the file or pipe in local_path to remote_path in the installer environment,
4650 after kexec but before installation. Can be repeated.
4751* --no-substitute-on-destination
4852 disable passing --substitute-on-destination to nix-copy
53+ implies --no-use-machine-substituters
54+ * --no-use-machine-substituters
55+ don't copy the substituters from the machine to be installed into the installer environment
4956* --debug
5057 enable debug output
58+ * --show-trace
59+ show nix build traces
5160* --option <key> <value>
5261 nix option to pass to every nix related command
5362* --from <store-uri>
@@ -56,6 +65,22 @@ Options:
5665 build the closure on the remote machine instead of locally and copy-closuring it
5766* --vm-test
5867 build the system and test the disk configuration inside a VM without installing it to the target.
68+ * --generate-hardware-config nixos-facter|nixos-generate-config <path>
69+ generate a hardware-configuration.nix file using the specified backend and write it to the specified path.
70+ The backend can be either 'nixos-facter' or 'nixos-generate-config'.
71+ * --phases
72+ comma separated list of phases to run. Default is: kexec,disko,install,reboot
73+ kexec: kexec into the nixos installer
74+ disko: first unmount and destroy all filesystems on the disks we want to format, then run the create and mount mode
75+ install: install the system
76+ reboot: unmount the filesystems, export any ZFS pools and reboot the machine
77+ * --disko-mode disko|mount|format
78+ set the disko mode to format, mount or destroy. Default is disko.
79+ disko: first unmount and destroy all filesystems on the disks we want to format, then run the create and mount mode
80+ * --no-disko-deps
81+ This will only upload the disko script and not the partitioning tools dependencies.
82+ Installers usually have dependencies available.
83+ Use this option if your target machine has not enough RAM to store the dependencies in memory.
5984* --build-on auto|remote|local
6085 sets the build on settings to auto, remote or local. Default is auto.
6186 auto: tries to figure out, if the build is possible on the local host, if not falls back gracefully to remote build
0 commit comments