Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Latest commit

 

History

History
118 lines (108 loc) · 4.37 KB

README.md

File metadata and controls

118 lines (108 loc) · 4.37 KB

maubot.nix

Deprecated in favor of nixpkgs after being upstreamed

Old readme

Instruction:

  1. Install the NixOS module. For flake users, add this flake's nixosModules.default output to your system. For everyone else, use something like this:

    imports = [
      (import (builtins.fetchGit {
        url = "https://github.com/chayleaf/maubot.nix";
        rev = "commit hash"; # this line is optional, but recommended
      })).nixosModules.default
    ];
  2. Set services.maubot.enable to true.

  3. If you want to use PostgreSQL instead of SQLite, do this:

    services.maubot.settings.database = "postgresql://maubot@localhost/maubot";

    If the PostgreSQL connection requires a password, you will add it later on step 8.

  4. If you plan to expose your Maubot interface to the web, do something like this:

    services.nginx.virtualHosts."matrix.example.org".locations = {
      "/_matrix/maubot/" = {
        proxyPass = "http://127.0.0.1:${toString config.services.maubot.settings.server.port}";
        proxyWebsockets = true;
      };
    };
    services.maubot.settings.server.public_url = "matrix.example.org";
    # do the following only if you want to use something other than /_matrix/maubot...
    services.maubot.settings.server.ui_base_path = "/another/base/path";
  5. Optionally, set services.maubot.pythonPackages to a list of python3 packages to make available for Maubot plugins.

  6. Optionally, set services.maubot.plugins to a list of Maubot plugins (full list available at https://plugins.maubot.xyz/):

    services.maubot.plugins = with config.services.maubot.package.plugins; [
      reactbot
      # This will only change the default config! After you create a
      # plugin instance, the default config will be copied into that
      # instance's config in Maubot database, and base config changes
      # won't be reflected
      (rss.override {
        base_config = {
          update_interval = 60;
          max_backoff = 7200;
          spam_sleep = 2;
          command_prefix = "rss";
          admins = [ "@chayleaf:pavluk.org" ];
        };
      })
    ];
    # ...or...
    services.maubot.plugins = config.services.maubot.package.plugins.allOfficialPlugins;
    # ...or...
    services.maubot.plugins = config.services.maubot.package.plugins.allPlugins;
    # ...or...
    services.maubot.plugins = with config.services.maubot.package.plugins; [
      (weather.override {
        # you can pass base_config as a string
        base_config = ''
          default_location: New York
          default_units: M
          default_language:
          show_link: true
          show_image: false
        '';
      })
    ] ++ allOfficialPlugins;
  7. Start Maubot at least once before doing the following steps.

  8. If your PostgreSQL connection requires a password, add database: postgresql://user:password@localhost/maubot to /var/lib/maubot/config.yaml. This overrides the Nix-provided config. Even then, don't remove the database line from Nix config so the module knows you use PostgreSQL!

  9. To create a user account for logging into Maubot web UI and configuring it, generate a password using the shell command mkpasswd -R 12 -m bcrypt, and edit /var/lib/maubot/config.yaml with the following:

    admins:
        admin_username: $2b$12$g.oIStUeUCvI58ebYoVMtO/vb9QZJo81PsmVOomHiNCFbh0dJpZVa

    Where admin_username is your username, and $2b... is the bcrypted password.

  10. Optional: if you want to be able to register new users with the Maubot CLI (mbc), and your homeserver is private, add your homeserver's registration key to /var/lib/maubot/config.yaml:

homeservers:
    matrix.example.org:
        url: https://matrix.example.org
        secret: your-very-secret-key
  1. Restart Maubot after editing /var/lib/maubot/config.yaml, and you're done! Open https://matrix.example.org/_matrix/maubot, log in and start using Maubot! If you want to use mbc CLI, use this flake's output packages.${builtins.currentSystem}.maubot. If you want to develop Maubot plugins and need the maubot Python module for IDE support, use packages.${builtins.currentSystem}.maubot-lib. You can also use this flake's output overlays.default, in that case you should use python3Packages.maubot instead of maubot-lib.