2024-09-09 01:41:34 +00:00
|
|
|
# WARNING
|
|
|
|
|
|
|
|
## This configuration is not meant for public usage
|
|
|
|
|
2024-09-09 00:22:14 +00:00
|
|
|
# Install
|
2024-09-09 00:06:57 +00:00
|
|
|
|
2024-09-09 00:22:14 +00:00
|
|
|
## Remote (with NixOS Anywhere)
|
|
|
|
|
|
|
|
1. Clone this repository
|
|
|
|
|
|
|
|
```sh
|
|
|
|
git clone https://github.com/Myned/nixos
|
|
|
|
```
|
|
|
|
|
|
|
|
2. Enable [Flakes](https://wiki.nixos.org/wiki/Flakes)
|
|
|
|
|
|
|
|
3. Boot from NixOS [minimal installer](https://nixos.org/download.html#nixos-iso)
|
|
|
|
|
|
|
|
4. Create machine-specific modules in `machines/MACHINE/`
|
|
|
|
|
2024-09-09 01:41:34 +00:00
|
|
|
b. Machine configuration and hostname in `default.nix`
|
2024-09-09 00:22:14 +00:00
|
|
|
|
|
|
|
```nix
|
2024-09-09 01:41:34 +00:00
|
|
|
{ custom.hostname = "MACHINE"; }
|
2024-09-09 00:22:14 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
c. [Disko](https://github.com/nix-community/disko) layout in `disko.nix`
|
|
|
|
|
|
|
|
```sh
|
|
|
|
# Verify /dev identifier on machine
|
|
|
|
lsblk
|
|
|
|
|
|
|
|
# Verify EFI/BIOS firmware on machine
|
|
|
|
[ -d /sys/firmware/efi/efivars ] && echo "UEFI" || echo "BIOS"
|
|
|
|
```
|
|
|
|
|
|
|
|
d. Generated hardware configuration in `hardware-configuration.nix`
|
|
|
|
|
|
|
|
```sh
|
|
|
|
nixos-generate-config --show-hardware-config --no-filesystems --root /mnt
|
|
|
|
```
|
|
|
|
|
|
|
|
5. Choose profile and add machine-specific modules to `flake.in.nix`
|
|
|
|
|
|
|
|
```nix
|
2024-09-09 01:41:34 +00:00
|
|
|
MACHINE = BRANCH [ ./profiles/PROFILE ./machines/MACHINE ];
|
2024-09-09 00:22:14 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
6. Generate `flake.nix` with [flakegen](https://github.com/jorsn/flakegen)
|
|
|
|
|
|
|
|
```sh
|
|
|
|
git add .
|
|
|
|
nix run .#genflake flake.nix
|
|
|
|
nix flake lock
|
|
|
|
```
|
|
|
|
|
|
|
|
7. Copy host public SSH key to root on machine
|
|
|
|
|
|
|
|
```sh
|
|
|
|
# On machine
|
|
|
|
sudo passwd root
|
|
|
|
```
|
|
|
|
|
|
|
|
```sh
|
|
|
|
# On host
|
|
|
|
ssh-copy-id root@MACHINE
|
|
|
|
```
|
|
|
|
|
|
|
|
8. Test and execute [NixOS Anywhere](https://github.com/nix-community/nixos-anywhere)
|
|
|
|
|
|
|
|
```sh
|
|
|
|
nixos-anywhere --vm-test -f .#MACHINE root@IP
|
|
|
|
nixos-anywhere -f .#MACHINE root@IP
|
|
|
|
```
|
|
|
|
|
|
|
|
9. Shutdown, detach ISO, and reboot
|