Skip to content

Conversation

boogiewoogit
Copy link

@boogiewoogit boogiewoogit commented Jul 6, 2025

To allow for declarative configuration in the nixos module, writing to spacebar's config file is disabled when the environment variable CONFIG_READONLY is set accordingly, which the module does. (see #1310)

To use the module, the following snippet can be added to the nixos configuration, where spacebarchat-server-flake refers to the flake input github:spacebarchat/server:

imports = [ spacebarchat-server-flake.nixosModules.default ];

services.spacebarchat-server = {
  enable = true;
  extraEnvironment = { ... };   ## see https://docs.spacebar.chat/setup/server/configuration/env/ for possible attributes
  settings = { ... };           ## see https://docs.spacebar.chat/setup/server/configuration/ for possible attributes
};

Note that no automatic nginx, external database and rabbitMQ setups are provided by the module yet.

default = {};
description = ''
Environment variables passed to spacebarchat-server.
See <link xlink:href="https://docs.spacebar.chat/setup/server/configuration/env"/>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this was supposed to be markdown?

Comment on lines +26 to +30
PORT = lib.mkOption {
type = lib.types.port;
default = 3001;
description = "Port to listen on. Used by all components, including bundle. If using bundle, all components run under the same port";
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, you probably shouldn't be using bundle in production :)
Spacebar benefits a lot from running as separate processes.

Comment on lines 31 to 36
DATABASE = lib.mkOption {
type = lib.types.str;
default = "database.db";
example = "postgres://username:passwort@host-IP:port/databaseName";
description = "Database connection string. Defaults to SQLite3 at project root";
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this to a lib.types.path to avoid putting credentials in the nix store? I'd like to support this for all secrets in config aswell.

@TheArcaneBrony
Copy link
Member

I should probably have given you this earlier, but here's a reference of the WIP module we've been using on non-prod servers:

@boogiewoogit
Copy link
Author

After confirming that a module should split the components and handle distributed setups, which this PR doesn't, I'll close this for now.

@boogiewoogit boogiewoogit reopened this Jul 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants