mirror of
https://codeberg.org/privacy1st/nixos-anywhere-example
synced 2024-11-21 22:03:19 +01:00
55 lines
1.6 KiB
Markdown
55 lines
1.6 KiB
Markdown
# disko + nixos-anywhere
|
|
|
|
This is an example repo for nixos-anywhere and disko.
|
|
|
|
## Build installer ISO with SSH
|
|
|
|
```shell
|
|
nix-build '<nixpkgs/nixos>' -A config.system.build.isoImage -I nixos-config=iso.nix
|
|
ls result/iso/
|
|
```
|
|
|
|
## Hardware Configuration
|
|
|
|
Boot the target machine into NixOS live ISO. Then execute the following, ideally while connected via SSH:
|
|
|
|
```shell
|
|
nixos-generate-config --no-filesystems --root /mnt
|
|
cat /mnt/etc/nixos/hardware-configuration.nix
|
|
```
|
|
|
|
Save the output to a new file in [./hardware-configs/](./hardware-configs/). In [./flake.nix](./flake.nix) replace `./hardware-configs/yodaHP.nix` with it.
|
|
|
|
Note: The hardware configuration should not contain any `fileSystems.<name>` options as these are generated based on your disko configuration.
|
|
|
|
## Installation
|
|
|
|
To run the interactive vm test run:
|
|
|
|
```shell
|
|
nix --extra-experimental-features nix-command --extra-experimental-features flakes \
|
|
run github:numtide/nixos-anywhere -- -f '.#mysystem' --vm-test
|
|
```
|
|
|
|
To install on remote target machine:
|
|
|
|
```shell
|
|
# GNOME Boxes
|
|
#nix --extra-experimental-features nix-command --extra-experimental-features flakes \
|
|
# run github:numtide/nixos-anywhere -- --flake '.#mysystem' -p 2222 root@localhost
|
|
|
|
# yodaHP
|
|
nix --extra-experimental-features nix-command --extra-experimental-features flakes \
|
|
run github:numtide/nixos-anywhere -- --flake '.#mysystem' -p 22 root@192.168.178.105
|
|
```
|
|
|
|
## Updating dependencies
|
|
|
|
Recreate the lock file (i.e. update all inputs) and commit the new lock file:
|
|
|
|
```shell
|
|
nix --extra-experimental-features nix-command --extra-experimental-features flakes \
|
|
flake update --commit-lock-file
|
|
```
|
|
|