Home Explore Blog Models CI



nixpkgs

1st chunk of `nixos/doc/manual/configuration/mattermost.chapter.md`
8326f2d7b9ef7bd1739e1692263ff11f0728bd5a970f6b440000000100000912
# Mattermost {#sec-mattermost}

The NixOS Mattermost module lets you build [Mattermost](https://mattermost.com)
instances for collaboration over chat, optionally with custom builds of plugins
specific to your instance.

To enable Mattermost using Postgres, use a config like this:

```nix
{
  services.mattermost = {
    enable = true;

    # You can change this if you are reverse proxying.
    host = "0.0.0.0";
    port = 8065;

    # Allow modifications to the config from Mattermost.
    mutableConfig = true;

    # Override modifications to the config with your NixOS config.
    preferNixConfig = true;

    socket = {
      # Enable control with the `mmctl` socket.
      enable = true;

      # Exporting the control socket will add `mmctl` to your PATH, and export
      # MMCTL_LOCAL_SOCKET_PATH systemwide. Otherwise, you can get the socket
      # path out of `config.mattermost.socket.path` and set it manually.
      export = true;
    };

    # For example, to disable auto-installation of prepackaged plugins.
    settings.PluginSettings.AutomaticPrepackagedPlugins = false;
  };
}
```

As of NixOS 25.05, Mattermost uses peer authentication with Postgres or
MySQL by default. If you previously used password auth on localhost,
this will automatically be configured if your `stateVersion` is set to at least
`25.05`.

## Using the Mattermost derivation {#sec-mattermost-derivation}

The nixpkgs `mattermost` derivation runs the entire test suite during the
`checkPhase`. This test suite is run with a live MySQL and Postgres database
instance in the sandbox. If you are building Mattermost, this can take a while,
especially if it is building on a resource-constrained system.

The following passthrus are designed to assist with enabling or disabling
the `checkPhase`:

- `mattermost.withTests`
- `mattermost.withoutTests`

The default (`mattermost`) is an alias for `mattermost.withTests`.

## Using Mattermost plugins {#sec-mattermost-plugins}

You can configure Mattermost plugins by either using prebuilt binaries or by
building your own. We test building and using plugins in the NixOS test suite.

Mattermost plugins are tarballs containing a system-specific statically linked
Go binary and webapp resources.

Here is an example with a prebuilt plugin tarball:

```nix
{
  services.mattermost = {

Title: Mattermost on NixOS: Configuration, Derivation, and Plugins
Summary
This document describes how to set up and configure Mattermost instances using the NixOS module. It covers basic enablement with PostgreSQL, host and port settings, mutable configuration options, and the use of the `mmctl` socket for control. It also details changes in default database authentication (peer auth for Postgres/MySQL from NixOS 25.05) and explains the `mattermost` derivation's `checkPhase`, offering `withTests` and `withoutTests` options to manage the lengthy test suite. Finally, it introduces how to configure Mattermost plugins, either using prebuilt binaries or building custom ones, noting that plugins are system-specific tarballs.