Mastodon
Free and open-source software platform for decentralized social networking.
Declared in: projects/Mastodon/default.nix
Demo
Implement missing demoOptions
services.mastodon
- 
  
  
This key must be set to enable the Active Record Encryption feature within Rails that Mastodon uses to encrypt and decrypt some database attributes. A new Active Record keys can be generated by running:
nix build -f '<nixpkgs>' mastodon; cd result; RAILS_ENV=production ./bin/rails db:encryption:initIf this file does not exist, it will be created with a new Active Record keys.
- Type:
 string- Default:
 "/var/lib/mastodon/secrets/active-record-encryption-deterministic-key"- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
This key must be set to enable the Active Record Encryption feature within Rails that Mastodon uses to encrypt and decrypt some database attributes. A new Active Record keys can be generated by running:
nix build -f '<nixpkgs>' mastodon; cd result; RAILS_ENV=production ./bin/rails db:encryption:initIf this file does not exist, it will be created with a new Active Record keys.
- Type:
 string- Default:
 "/var/lib/mastodon/secrets/active-record-encryption-key-derivation-salt"- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
This key must be set to enable the Active Record Encryption feature within Rails that Mastodon uses to encrypt and decrypt some database attributes. A new Active Record keys can be generated by running:
nix build -f '<nixpkgs>' mastodon; cd result; RAILS_ENV=production ./bin/rails db:encryption:initIf this file does not exist, it will be created with a new Active Record keys.
- Type:
 string- Default:
 "/var/lib/mastodon/secrets/active-record-encryption-primary-key"- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Do automatic database migrations.
- Type:
 boolean- Default:
 true- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
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:
/ -> ${pkgs.mastodon}/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 in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Configure local PostgreSQL database server for Mastodon.
- Type:
 boolean- Default:
 true- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Database host address or unix socket.
- Type:
 string- Default:
 "/run/postgresql"- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Database name.
- Type:
 string- Default:
 "mastodon"- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
A file containing the password corresponding to {option}
database.user.- Type:
 null or absolute path- Default:
 null- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Database host port.
- Type:
 null or 16 bit unsigned integer; between 0 and 65535 (both inclusive)- Default:
 if config.services.mastodon.database.createLocally then null else 5432- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Database user.
- Type:
 string- Default:
 "mastodon"- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Elasticsearch host. If it is not null, Elasticsearch full text search will be enabled.
- Type:
 null or string- Default:
 null- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Path to file containing password for optionally authenticating with Elasticsearch.
- Type:
 null or absolute path- Default:
 null- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Elasticsearch port.
- Type:
 16 bit unsigned integer; between 0 and 65535 (both inclusive)- Default:
 9200- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
If provided, adds a prefix to indexes in Elasticsearch. This allows to use the same Elasticsearch cluster between different projects or Mastodon servers.
- Type:
 null or string- Default:
 null- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
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"- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Used for optionally authenticating with Elasticsearch.
- Type:
 null or string- Default:
 null- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Whether to enable Mastodon, a federated social network server.
- Type:
 boolean- Default:
 false- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
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 in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Extra environment variables to pass to all mastodon services.
- Type:
 attribute set- Default:
 { }- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Extra environment files to pass to all mastodon services. Useful for passing down environmental secrets.
- Type:
 list of absolute path- Default:
 [ ]- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Group under which mastodon runs.
- Type:
 string- Default:
 "mastodon"- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
The domain serving your Mastodon instance.
- Type:
 string- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
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- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
How old remote media needs to be in order to be removed.
- Type:
 signed integer- Default:
 30- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
How often to remove remote media.
The format is described in {manpage}
systemd.time(7).- Type:
 string- Default:
 "daily"- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
The mastodon package to use.
- Type:
 package- Default:
 pkgs.mastodon- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Configure local Redis server for Mastodon.
- Type:
 boolean- Default:
 true- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Use Unix socket
- Type:
 boolean- Default:
 true- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
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 in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
A file containing the password for Redis database.
- Type:
 null or absolute path- Default:
 null- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
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 in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
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/bundle exec rails secretIf 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 in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
TCP port used by the mastodon-sidekiq service.
- Type:
 16 bit unsigned integer; between 0 and 65535 (both inclusive)- Default:
 55002- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
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; }; }- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
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", "fasp", "push", "pull", "mailers", "scheduler", "ingress")- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Number of threads this process should use for executing jobs. If null, the configured
sidekiqThreadsare used.- Type:
 null or signed integer- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Worker threads used by the mastodon-sidekiq-all service. If
sidekiqProcessesis configured and any processes specify nullthreads, this value is used.- Type:
 signed integer- Default:
 25- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Authenticate with the SMTP server using username and password.
- Type:
 boolean- Default:
 false- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Configure local Postfix SMTP server for Mastodon.
- Type:
 boolean- Default:
 true- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
"From" address used when sending Emails to users.
- Type:
 string- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
SMTP host used when sending emails to users.
- Type:
 string- Default:
 "127.0.0.1"- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Path to file containing the SMTP password.
- Type:
 null or absolute path- Default:
 null- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
SMTP port used when sending emails to users.
- Type:
 16 bit unsigned integer; between 0 and 65535 (both inclusive)- Default:
 25- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
SMTP login name.
- Type:
 null or string- Default:
 null- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
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- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
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 in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
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
mastodonpackage 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 in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
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_keysIf 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 in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
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; RAILS_ENV=production bin/rake webpush:generate_keysIf {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 in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
TCP port used by the mastodon-web service.
- Type:
 16 bit unsigned integer; between 0 and 65535 (both inclusive)- Default:
 55001- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Processes used by the mastodon-web service.
- Type:
 signed integer- Default:
 2- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 - 
  
  
Threads per process used by the mastodon-web service.
- Type:
 signed integer- Default:
 5- Declared in:
 - nixos/modules/services/web-apps/mastodon.nix
 
 
services.mastodon.activeRecordEncryptionDeterministicKeyFile
services.mastodon.activeRecordEncryptionKeyDerivationSaltFile
services.mastodon.activeRecordEncryptionPrimaryKeyFile
services.mastodon.automaticMigrations
services.mastodon.configureNginx
services.mastodon.database.createLocally
services.mastodon.database.host
services.mastodon.database.name
services.mastodon.database.passwordFile
services.mastodon.database.port
services.mastodon.database.user
services.mastodon.elasticsearch.host
services.mastodon.elasticsearch.passwordFile
services.mastodon.elasticsearch.port
services.mastodon.elasticsearch.prefix
services.mastodon.elasticsearch.preset
services.mastodon.elasticsearch.user
services.mastodon.enable
services.mastodon.enableUnixSocket
services.mastodon.extraConfig
services.mastodon.extraEnvFiles
services.mastodon.group
services.mastodon.localDomain
services.mastodon.mediaAutoRemove.enable
services.mastodon.mediaAutoRemove.olderThanDays
services.mastodon.mediaAutoRemove.startAt
services.mastodon.package
services.mastodon.redis.createLocally
services.mastodon.redis.enableUnixSocket
services.mastodon.redis.host
services.mastodon.redis.passwordFile
services.mastodon.redis.port
services.mastodon.secretKeyBaseFile
services.mastodon.sidekiqPort
services.mastodon.sidekiqProcesses
services.mastodon.sidekiqProcesses..jobClasses 
services.mastodon.sidekiqProcesses..threads 
services.mastodon.sidekiqThreads
services.mastodon.smtp.authenticate
services.mastodon.smtp.createLocally
services.mastodon.smtp.fromAddress
services.mastodon.smtp.host
services.mastodon.smtp.passwordFile
services.mastodon.smtp.port
services.mastodon.smtp.user
services.mastodon.streamingProcesses
services.mastodon.trustedProxy
services.mastodon.user
services.mastodon.vapidPrivateKeyFile
services.mastodon.vapidPublicKeyFile
services.mastodon.webPort
services.mastodon.webProcesses
services.mastodon.webThreads
Examples
This project is funded by NLnet through these subgrants:
- Commons
 - Mastodon-for-institutions
 - Entrust
 - Mastodon-Quoting
 - Review
 - Mastodon