# Storage

> How storage is configured.

---

LLMS index: [llms.txt](/llms.txt)

---

## Storage module

The storage module is designed to help automatically manage files for your system, providing snapshots, and automatically cleaning up unused files. In the future it is planned to be able to automatically back up data.

The current implementation of the storage module uses [ZFS](https://openzfs.org/wiki/Main_Page) datasets to accomplish these goals combined with [disko](https://github.com/nix-community/disko) to bind datasets to nix mount points. (as well as handle provisioning new systems)


## Types of datasets

Our datasets are broken down into different classes that have different properties. These properties are built off of each other some requiring others to be a feature of the dataset before they are valid. Properties are listed one after the other at the start of the name of the dataset after the pool.

The first property of a dataset is its persistence level. The persistence level can ether be `ephemeral` or `persist`

### `ephemeral`

Ephemeral datasets can be wiped on every single boot. They exist so that you are able to bind locations that you do not want to keep around to make it easier to keep track of what data is actually important on a disk. The main use case of this data is in the implementation of impermanence.

### `persist`

Persist datasets are for any data that needs to be kept around. This can be anything from user files, application state, or system files.

#### `local`

Local datasets are for files that are only ever meant to exist on this device. This is anything from local device files such as system files,or device specific credentials to files that we just don't care to have leave our device.

#### `replicate`

Replicate datasets are for files that can (but not always will) be synced to other devices.

## Included datasets

Devices with the storage module enabled will come with a few baked in datasets. They are as follows:

| pool path                                   | mount                                 |
| ------------------------------------------- | ------------------------------------- |
| `rpool/ephemeral/system/root`               | `/`                                   |
| `rpool/ephemeral/home/<user>`               | `/home/<user>`                        |
| `rpool/persist/local/nix`                   | `/nix`                                |
| `rpool/persist/replicate/system/var/log`    | `/persist/replicate/system/var/log`   |
| `rpool/persist/replicate/system/root`       | `/persist/replicate/system/root`      |
| `rpool/persist/replicate/home/<user>`       | `/persist/replicate/home/<user>`      |

TODO: home manager should have persist local directory for users binaries

TODO: write this section

### Home manager datasets

TODO: talk about how home manager can create datasets

### Automatic dataset creation

TODO: talk about plans for datasets to automatically be created
