# NixOS Configuration

Now using Flakes \o/

## Updating Channels/the Lockfile

```
nix flake lock
```

```
nix flake update
```

## Installing/Updating the System

```
sudo nixos-rebuild switch --flake <path-to-repo>#<hostname>
sudo nixos-rebuild switch --flake .#w1n5t0n
```

## Mail Setup

```
secret-tool store --label 'foo@example.com' email 'foo@example.com'
```


# Encrypted Btrfs Setup

* cryptsetup luksFormat --format=luks1 /...
* cryptsetup luksOpen /... system
* mkfs.btrfs /dev/mapper/system
* mount /dev/mapper/system /mnt
* btrfs subvolume create /mnt/root
* btrfs subvolume create /mnt/home
* btrfs subvolume create /mnt/nix
* btrfs subvolume create /mnt/swap

| subvolume | mount options |
| --- | --- |
| `home` | `compress=zstd` |
| `swap` | `compress=zstd,noatime` |
| `root` | `compress=zstd` |
| `nix` | `compress=zstd,noatime` |

* `/boot/efi` as vfat TODO: partitioning command
* TODO: create swap
* mount subvolumes
* `nixos-generate-config --root /mnt
* add mount options in `hardware-configuration.nix` / create matching configuration in `./machines`
* TODO: config for luks, bootloader, ...
* For `snapper`: create `.snapshots` subvolume in each subvolume to be backed up