-
-
Notifications
You must be signed in to change notification settings - Fork 252
Add nixos module and (very basic, template) test #1311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
nix/modules/default/default.nix
Outdated
default = {}; | ||
description = '' | ||
Environment variables passed to spacebarchat-server. | ||
See <link xlink:href="https://docs.spacebar.chat/setup/server/configuration/env"/>. |
There was a problem hiding this comment.
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?
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"; | ||
}; |
There was a problem hiding this comment.
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.
nix/modules/default/default.nix
Outdated
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"; | ||
}; |
There was a problem hiding this comment.
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.
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: |
After confirming that a module should split the components and handle distributed setups, which this PR doesn't, I'll close this for now. |
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 inputgithub:spacebarchat/server
:Note that no automatic nginx, external database and rabbitMQ setups are provided by the module yet.