docs: 📝 Document Nix installation

This commit is contained in:
Jesse Wierzbinski 2025-04-15 13:03:52 +02:00
parent 2d921438a9
commit c26e896afe
No known key found for this signature in database
4 changed files with 99 additions and 3 deletions

View file

@ -36,7 +36,16 @@ export default defineConfig({
sidebar: [ sidebar: [
{ {
text: "Installation", text: "Installation",
link: "/setup/installation", items: [
{
text: "Normal",
link: "/setup/installation",
},
{
text: "Nix",
link: "/setup/nix",
},
],
}, },
{ {
text: "CLI", text: "CLI",

86
docs/setup/nix.md Normal file
View file

@ -0,0 +1,86 @@
# Nix Module
This project is packaged as a [Nix Flake](https://nixos.wiki/wiki/Flakes), which can be used to build and run the project in a reproducible environment.
## Installation
### Flake-based NixOS installs
Add the following to your `inputs` in your `flake.nix`:
```nix
inputs = {
# ...
versia-server = {
url = "github:versia-pub/server";
inputs.nixpkgs.follows = "nixpkgs";
};
};
```
Then, add this to your `nixosConfigurations`:
```nix
nixosConfigurations = {
# ...
my-server = {
system = "x86_64-linux"; # arm64-linux is also supported
modules = [
# ...
versia-server.nixosModules.default
];
};
};
```
You are now ready to use the NixOS module.
## Usage
This module exposes the following configuration option:
```nix
services.versia-server = {
enable = true;
dataDir = "/var/lib/versia-server";
user = "versia-server";
group = "versia-server";
nodes = {
api = {
main = {};
backup = {
configOverrides.http.port = 2734;
};
};
worker = {
one = {};
two = {};
three = {
configOverrides.postgres.port = 5433;
};
}:
};
config = {
# ...
http = {
# ...
bind = "0.0.0.0";
port = 8080;
base_url = "https://versia.example";
};
# ...
};
};
```
### Configuration Options
- `enable`: Whether to enable the service. Default: `true`.
- `dataDir`: The directory where the data will be stored. Default: `/var/lib/versia-server`.
- `user`: The user under which the service will run. Default: `versia-server`.
- `group`: The group under which the service will run. Default: `versia-server`.
- `nodes`: A set of nodes to run. Each node can have its own configuration overrides, which will be merged with the default configuration. You must have at least one of each type (`api` and `worker`).
- `config`: Contents of the config file, which is serialized to TOML. Check the Versia Server documentation for information on its contents.

View file

@ -57,8 +57,9 @@
}; };
}) })
// { // {
nixosModules = { nixosModules = rec {
versia-server = import ./nix/module.nix; versia-server = import ./nix/module.nix;
default = versia-server;
}; };
}; };
} }

View file

@ -78,7 +78,7 @@ in {
freeformType = configFormat.type; freeformType = configFormat.type;
options = {}; options = {};
}; };
description = "Contents of the config file. Check the Versia Server documentation for information on its contents."; description = "Contents of the config file, which is serialized to TOML. Check the Versia Server documentation for information on its contents.";
}; };
}; };
}; };