Skip to content

Mastodon

services.mastodon.automaticMigrations

Do automatic database migrations.

Type: boolean

Default

true

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.configureNginx

Configure nginx as a reverse proxy for mastodon. Note that this makes some assumptions on your setup, and sets settings that will affect other virtualHosts running on your nginx instance, if any. Alternatively you can configure a reverse-proxy of your choice to serve these paths:

/ -> $(nix-instantiate --eval '<nixpkgs>' -A mastodon.outPath)/public

/ -> 127.0.0.1:{{ webPort }}(If there was no file in the directory above.)

/system/ -> /var/lib/mastodon/public-system/

/api/v1/streaming/ -> 127.0.0.1:{{ streamingPort }}

Make sure that websockets are forwarded properly. You might want to set up caching of some requests. Take a look at mastodon's provided nginx configuration at https://github.com/mastodon/mastodon/blob/master/dist/nginx.conf.

Type: boolean

Default

false

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.database.createLocally

Configure local PostgreSQL database server for Mastodon. Type: boolean

Default

true

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.database.host

Database host address or unix socket. Type: string

Default

"/run/postgresql"

Example

"192.168.23.42"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.database.name

Database name. Type: string

Default

"mastodon"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.database.passwordFile

A file containing the password corresponding to {option}database.user.

Type: null or path

Default

null

Example

"/var/lib/mastodon/secrets/db-password"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.database.port

Database host port. Type: null or 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default

if config.services.mastodon.database.createLocallythen nullelse 5432

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.database.user

Database user. Type: string

Default

"mastodon"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.elasticsearch.host

Elasticsearch host. If it is not null, Elasticsearch full text search will be enabled.

Type: null or string

Default

null

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.elasticsearch.passwordFile

Path to file containing password for optionally authenticating with Elasticsearch.

Type: null or path

Default

null

Example

"/var/lib/mastodon/secrets/elasticsearch-password"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.elasticsearch.port

Elasticsearch port. Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default

9200

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.elasticsearch.preset

It controls the ElasticSearch indices configuration (number of shards and replica).

Type: one of "single_node_cluster", "small_cluster", "large_cluster"

Default

"single_node_cluster"

Example

"large_cluster"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.elasticsearch.user

Used for optionally authenticating with Elasticsearch. Type: null or string

Default

null

Example

"elasticsearch-mastodon"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.enable

Whether to enable Mastodon, a federated social network server. Type: boolean

Default

false

Example

true

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.enableUnixSocket

Instead of binding to an IP address like 127.0.0.1, you may bind to a Unix socket. This variable is process-specific, e.g. you need different values for every process, and it works for both web (Puma) processes and streaming API (Node.js) processes.

Type: boolean

Default

true

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.extraConfig

Extra environment variables to pass to all mastodon services.

Type: attribute set

Default

{ }

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.extraEnvFiles

Extra environment files to pass to all mastodon services. Useful for passing down environmental secrets.

Type: list of path

Default

[ ]

Example

["/etc/mastodon/s3config.env"]

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.group

Group under which mastodon runs.

Type: string

Default

"mastodon"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.localDomain

The domain serving your Mastodon instance. Type: string

Example

"social.example.org"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.mediaAutoRemove.enable

Automatically remove remote media attachments and preview cards older than the configured amount of days.

Recommended in https://docs.joinmastodon.org/admin/setup/.

Type: boolean

Default

true

Example

false

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.mediaAutoRemove.olderThanDays

How old remote media needs to be in order to be removed.

Type: signed integer

Default

30

Example

14

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.mediaAutoRemove.startAt

How often to remove remote media.

The format is described in {manpage}systemd.time(7).

Type: string

Default

"daily"

Example

"hourly"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.otpSecretFile

Path to file containing the OTP secret. A new OTP secret can be generated by running:

nix build -f '<nixpkgs>' mastodon; cd result; bin/rake secret

If this file does not exist, it will be created with a new OTP secret.

Type: string

Default

"/var/lib/mastodon/secrets/otp-secret"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.package

Mastodon package to use. Type: package

Default

pkgs.mastodon

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.redis.createLocally

Configure local Redis server for Mastodon. Type: boolean

Default

true

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.redis.enableUnixSocket

Use Unix socket Type: boolean

Default

true

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.redis.host

Redis host. Type: null or string

Default

if config.services.mastodon.redis.createLocally && !config.services.mastodon.redis.enableUnixSocket then "127.0.0.1" else null

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.redis.passwordFile

A file containing the password for Redis database. Type: null or path

Default

null

Example

"/run/keys/mastodon-redis-password"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.redis.port

Redis port. Type: null or 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default

if config.services.mastodon.redis.createLocally && !config.services.mastodon.redis.enableUnixSocket then 31637 else null

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.secretKeyBaseFile

Path to file containing the secret key base. A new secret key base can be generated by running:

nix build -f '<nixpkgs>' mastodon; cd result; bin/rake secret

If this file does not exist, it will be created with a new secret key base.

Type: string

Default

"/var/lib/mastodon/secrets/secret-key-base"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.sidekiqPort

TCP port used by the mastodon-sidekiq service. Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default

55002

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.sidekiqProcesses

How many Sidekiq processes should be used to handle background jobs, and which job classes they handle. Read the upstream documentation before configuring this! Type: attribute set of (submodule)

Default

{all = {jobClasses = [ ];threads = null;};}

Example

{all = {jobClasses = [ ];threads = null;};default = {jobClasses = ["default"];threads = 10;};ingress = {jobClasses = ["ingress"];threads = 5;};push-pull = {jobClasses = ["push""pull"];threads = 5;};}

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.sidekiqProcesses.<name>.jobClasses

If not empty, which job classes should be executed by this process. Only one process should handle the 'scheduler' class. If left empty, this process will handle the 'scheduler' class. Type: list of (one of "default", "push", "pull", "mailers", "scheduler", "ingress")

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.sidekiqProcesses.<name>.threads

Number of threads this process should use for executing jobs. If null, the configured sidekiqThreads are used. Type: null or signed integer

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.sidekiqThreads

Worker threads used by the mastodon-sidekiq-all service. If sidekiqProcesses is configured and any processes specify null threads, this value is used. Type: signed integer

Default

25

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.smtp.authenticate

Authenticate with the SMTP server using username and password. Type: boolean

Default

false

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.smtp.createLocally

Configure local Postfix SMTP server for Mastodon. Type: boolean

Default

true

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.smtp.fromAddress

"From" address used when sending Emails to users. Type: string

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.smtp.host

SMTP host used when sending emails to users. Type: string

Default

"127.0.0.1"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.smtp.passwordFile

Path to file containing the SMTP password.

Type: null or path

Default

null

Example

"/var/lib/mastodon/secrets/smtp-password"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.smtp.port

SMTP port used when sending emails to users. Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default

25

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.smtp.user

SMTP login name. Type: null or string

Default

null

Example

"mastodon@example.com"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.streamingProcesses

Number of processes used by the mastodon-streaming service. Please define this explicitly, recommended is the amount of your CPU cores minus one.

Type: positive integer, meaning >0

Example

3

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.trustedProxy

You need to set it to the IP from which your reverse proxy sends requests to Mastodon's web process, otherwise Mastodon will record the reverse proxy's own IP as the IP of all requests, which would be bad because IP addresses are used for important rate limits and security functions.

Type: string

Default

"127.0.0.1"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.user

User under which mastodon runs. If it is set to "mastodon", that user will be created, otherwise it should be set to the name of a user created elsewhere. In both cases, the mastodon package will be added to the user's package set and a tootctl wrapper to system packages that switches to the configured account and load the right environment.

Type: string

Default

"mastodon"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.vapidPrivateKeyFile

Path to file containing the private key used for Web Push Voluntary Application Server Identification. A new keypair can be generated by running:

nix build -f '<nixpkgs>' mastodon; cd result; bin/rake webpush:generate_keys

If this file does not exist, it will be created with a new private key.

Type: string

Default

"/var/lib/mastodon/secrets/vapid-private-key"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.vapidPublicKeyFile

Path to file containing the public key used for Web Push Voluntary Application Server Identification. A new keypair can be generated by running:

nix build -f '<nixpkgs>' mastodon; cd result; bin/rake webpush:generate_keys

If {option}mastodon.vapidPrivateKeyFiledoes not exist, it and this file will be created with a new keypair.

Type: string

Default

"/var/lib/mastodon/secrets/vapid-public-key"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.webPort

TCP port used by the mastodon-web service. Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default

55001

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.webProcesses

Processes used by the mastodon-web service. Type: signed integer

Default

2

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix

services.mastodon.webThreads

Threads per process used by the mastodon-web service. Type: signed integer

Default

5

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/web-apps/mastodon.nix