Skip to content

Commit 63eae64

Browse files
authored
Merge pull request #396 from nix-community/joerg-ci
fix flags in nixos-generate-config examples
2 parents 082fb15 + 44c8dfb commit 63eae64

File tree

5 files changed

+33
-12
lines changed

5 files changed

+33
-12
lines changed

docs/howtos/INDEX.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
[Using your own kexec image](./custom-kexec.md)
1414

15+
[Repair installations without wiping data](./disko-modes.md)
16+
1517
[Secrets and full disk encryption](./secrets.md)
1618

1719
[Use without flakes](./use-without-flakes.md)

docs/howtos/disko-modes.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Repair installations without wiping data
2+
3+
By default, nixos-anywhere will reformat all configured disks before running the
4+
installation. However it is also possible to mount the filesystems of an
5+
existing installation and run `nixos-install`. This is useful to recover from a
6+
mis-configured NixOS installation by first booting into a NixOS installer or
7+
recovery system.
8+
9+
To only mount existing filesystems, add `--disko-mode mount` to
10+
`nixos-anywhere`:
11+
12+
```
13+
nix run github:nix-community/nixos-anywhere -- --disko-mode mount --flake <path to configuration>#<configuration name> root@<ip address>
14+
```
15+
16+
1. This will first boot into a nixos-installer
17+
2. Mounts disks with disko
18+
3. Runs nixos-install based on the provided flake
19+
4. Reboots the machine.

docs/quickstart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,13 @@ If you also need to generate hardware configuration amend flags for
232232
nixos-generate-config:
233233

234234
```
235-
nix run --generate-hardware-config nixos-generate-config ./hardware-configuration.nix github:nix-community/nixos-anywhere -- --flake <path to configuration>#<configuration name> root@<ip address>
235+
nix run github:nix-community/nixos-anywhere -- --generate-hardware-config nixos-generate-config ./hardware-configuration.nix --flake <path to configuration>#<configuration name> root@<ip address>
236236
```
237237

238238
Or these flags if you are using nixos-facter instead:
239239

240240
```
241-
nix run --generate-hardware-config nixos-facter ./facter.json github:nix-community/nixos-anywhere -- --flake <path to configuration>#<configuration name> root@<ip address>
241+
nix run github:nix-community/nixos-anywhere -- --generate-hardware-config nixos-facter ./facter.json --flake <path to configuration>#<configuration name> root@<ip address>
242242
```
243243

244244
Adjust the location of `./hardware-configuration.nix` and `./facter.json`

docs/reference.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ Options:
7474
disko: first unmount and destroy all filesystems on the disks we want to format, then run the create and mount mode
7575
install: install the system
7676
reboot: reboot the machine
77-
* --disko-mode create|mount|disko
78-
set the disko mode to create, mount or destroy. Default is disko.
79-
format: create partition tables, zpools, lvms, raids and filesystems (Experimental: Can be run increntally, but use with caution and good backups)
80-
mount: mount the partition at the specified root-mountpoint
77+
* --disko-mode disko|mount|format
78+
set the disko mode to format, mount or destroy. Default is disko.
8179
disko: first unmount and destroy all filesystems on the disks we want to format, then run the create and mount mode
80+
mount: mount the partition at the specified root-mountpoint
81+
format: create partition tables, zpools, lvms, raids and filesystems (Experimental: Can be run increntally, but use with caution and good backups)
8282
```
8383

8484
## Explanation of known error messages

src/nixos-anywhere.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ Options:
117117
disko: first unmount and destroy all filesystems on the disks we want to format, then run the create and mount mode
118118
install: install the system
119119
reboot: reboot the machine
120-
* --disko-mode create|mount|disko
121-
set the disko mode to create, mount or destroy. Default is disko.
122-
format: create partition tables, zpools, lvms, raids and filesystems (Experimental: Can be run increntally, but use with caution and good backups)
123-
mount: mount the partition at the specified root-mountpoint
120+
* --disko-mode disko|mount|format
121+
set the disko mode to format, mount or destroy. Default is disko.
124122
disko: first unmount and destroy all filesystems on the disks we want to format, then run the create and mount mode
123+
mount: mount the partition at the specified root-mountpoint
124+
format: create partition tables, zpools, lvms, raids and filesystems (Experimental: Can be run increntally, but use with caution and good backups)
125125
USAGE
126126
}
127127

@@ -209,11 +209,11 @@ parseArgs() {
209209
;;
210210
--disko-mode)
211211
case "$2" in
212-
create | mount | disko)
212+
format | mount | disko)
213213
diskoMode=$2
214214
;;
215215
*)
216-
abort "Supported values for --disko-mode create, mount, disko. Unknown mode : $2"
216+
abort "Supported values for --disko-mode are disko, mount and format. Unknown mode : $2"
217217
;;
218218
esac
219219

0 commit comments

Comments
 (0)