2020-09-23 10:36:46 +02:00
|
|
|
# felschr's NixOS configuration
|
2019-08-24 13:12:32 +02:00
|
|
|
|
2020-09-23 10:36:46 +02:00
|
|
|
## Installation
|
|
|
|
|
2022-02-11 00:45:24 +01:00
|
|
|
Clone the configuration into `/etc/nixos`.
|
2020-09-23 10:36:46 +02:00
|
|
|
|
|
|
|
On a new machine run:
|
|
|
|
|
|
|
|
```sh
|
2021-01-29 01:25:41 +01:00
|
|
|
scripts/setup-partitions
|
2019-08-24 13:12:32 +02:00
|
|
|
```
|
2020-09-23 10:36:46 +02:00
|
|
|
|
2022-08-25 22:20:42 +02:00
|
|
|
Then move the resulting `/mnt/etc/nixos/hardware-configuration.nix` to `./hardware/<config>.nix`.
|
2022-02-11 00:45:24 +01:00
|
|
|
Update the configuration according to the script output, if necessary. Btrfs mount options likely need to be added, for example.
|
2022-08-25 22:20:42 +02:00
|
|
|
Copy the configuration from `/etc/nixos` to `/mnt/etc/nixos`.
|
2022-02-11 00:45:24 +01:00
|
|
|
|
|
|
|
Reference this hardware config in a `nixosConfigurations.<config>` section in `flake.nix`.
|
2020-09-23 10:36:46 +02:00
|
|
|
|
|
|
|
To install run the following command where `<config>` matches `outputs.nixosConfigurations.<config>` in `flake.nix`:
|
|
|
|
|
|
|
|
```sh
|
2022-08-25 22:20:42 +02:00
|
|
|
nixos-install --flake '/mnt/etc/nixos#<config>'
|
|
|
|
```
|
|
|
|
|
|
|
|
After the installation finished, set a password for the user:
|
|
|
|
```
|
|
|
|
passwd <user>
|
2020-09-23 10:36:46 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
## Updating
|
|
|
|
|
2022-02-11 00:45:24 +01:00
|
|
|
Update all flake inputs:
|
2020-09-23 10:36:46 +02:00
|
|
|
|
|
|
|
```sh
|
|
|
|
nix flake update
|
2022-02-11 00:45:24 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Update a specific flake input:
|
|
|
|
|
|
|
|
```
|
|
|
|
nix flake lock --update-input <input>
|
2020-09-23 10:36:46 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
## Rebuilding the system
|
|
|
|
|
|
|
|
Rebuild the system:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
sudo nixos-rebuild switch
|
|
|
|
```
|
|
|
|
|
2022-02-11 00:45:24 +01:00
|
|
|
Rebuild the system for a remote machine:
|
2020-09-23 10:36:46 +02:00
|
|
|
|
|
|
|
```sh
|
2022-02-11 00:45:24 +01:00
|
|
|
sudo nixos-rebuild switch --flake '/etc/nixos#<config>' --target-host user@hostname --use-remote-sudo
|
2019-08-24 13:12:32 +02:00
|
|
|
```
|