2018-08-19 17:08:07 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
2020-11-29 17:51:50 +00:00
|
|
|
cfg = config.services.hedgedoc;
|
|
|
|
|
2021-01-10 00:12:07 +00:00
|
|
|
# 21.03 will not be an official release - it was instead 21.05. This
|
|
|
|
# versionAtLeast statement remains set to 21.03 for backwards compatibility.
|
|
|
|
# See https://github.com/NixOS/nixpkgs/pull/108899 and
|
|
|
|
# https://github.com/NixOS/rfcs/blob/master/rfcs/0080-nixos-release-schedule.md.
|
2020-11-29 17:51:50 +00:00
|
|
|
name = if versionAtLeast config.system.stateVersion "21.03"
|
|
|
|
then "hedgedoc"
|
|
|
|
else "codimd";
|
2018-08-19 17:08:07 +01:00
|
|
|
|
2022-06-02 16:38:06 +01:00
|
|
|
settingsFormat = pkgs.formats.json {};
|
|
|
|
|
2018-08-19 17:08:07 +01:00
|
|
|
prettyJSON = conf:
|
2020-11-29 17:51:50 +00:00
|
|
|
pkgs.runCommandLocal "hedgedoc-config.json" {
|
2020-11-13 15:14:41 +00:00
|
|
|
nativeBuildInputs = [ pkgs.jq ];
|
|
|
|
} ''
|
2022-06-02 16:38:06 +01:00
|
|
|
jq '{production:del(.[]|nulls)|del(.[][]?|nulls)}' \
|
|
|
|
< ${settingsFormat.generate "hedgedoc-ugly.json" cfg.settings} \
|
|
|
|
> $out
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
in
|
|
|
|
{
|
2020-11-29 17:51:50 +00:00
|
|
|
imports = [
|
|
|
|
(mkRenamedOptionModule [ "services" "codimd" ] [ "services" "hedgedoc" ])
|
2022-06-02 16:38:06 +01:00
|
|
|
(mkRenamedOptionModule
|
|
|
|
[ "services" "hedgedoc" "configuration" ] [ "services" "hedgedoc" "settings" ])
|
2020-11-29 17:51:50 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
options.services.hedgedoc = {
|
|
|
|
enable = mkEnableOption "the HedgeDoc Markdown Editor";
|
2018-08-19 17:08:07 +01:00
|
|
|
|
|
|
|
groups = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2021-12-05 20:58:27 +00:00
|
|
|
Groups to which the service user should be added.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
workDir = mkOption {
|
|
|
|
type = types.path;
|
2020-11-29 17:51:50 +00:00
|
|
|
default = "/var/lib/${name}";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2020-11-29 17:51:50 +00:00
|
|
|
Working directory for the HedgeDoc service.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-06-02 16:38:06 +01:00
|
|
|
settings = let options = {
|
2018-08-19 17:08:07 +01:00
|
|
|
debug = mkEnableOption "debug mode";
|
|
|
|
domain = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2020-11-29 17:51:50 +00:00
|
|
|
example = "hedgedoc.org";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2020-11-29 17:51:50 +00:00
|
|
|
Domain name for the HedgeDoc instance.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
urlPath = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2020-11-29 17:51:50 +00:00
|
|
|
example = "/url/path/to/hedgedoc";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2020-11-29 17:51:50 +00:00
|
|
|
Path under which HedgeDoc is accessible.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
host = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "localhost";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Address to listen on.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
port = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 3000;
|
2021-10-03 17:06:03 +01:00
|
|
|
example = 80;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Port to listen on.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
path = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2020-11-29 17:51:50 +00:00
|
|
|
example = "/run/hedgedoc.sock";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Specify where a UNIX domain socket should be placed.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
allowOrigin = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
2020-11-29 17:51:50 +00:00
|
|
|
example = [ "localhost" "hedgedoc.org" ];
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
List of domains to whitelist.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
useSSL = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Enable to use SSL server. This will also enable
|
2022-07-28 22:19:15 +01:00
|
|
|
{option}`protocolUseSSL`.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
hsts = {
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2020-07-04 14:20:41 +01:00
|
|
|
Whether to enable HSTS if HTTPS is also enabled.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
maxAgeSeconds = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 31536000;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Max duration for clients to keep the HSTS status.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
includeSubdomains = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Whether to include subdomains in HSTS.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
preload = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Whether to allow preloading of the site's HSTS status.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
csp = mkOption {
|
|
|
|
type = types.nullOr types.attrs;
|
|
|
|
default = null;
|
2021-10-03 17:06:03 +01:00
|
|
|
example = literalExpression ''
|
2018-08-19 17:08:07 +01:00
|
|
|
{
|
|
|
|
enable = true;
|
|
|
|
directives = {
|
|
|
|
scriptSrc = "trustworthy.scripts.example.com";
|
|
|
|
};
|
|
|
|
upgradeInsecureRequest = "auto";
|
|
|
|
addDefaults = true;
|
|
|
|
}
|
|
|
|
'';
|
2022-08-03 21:46:41 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Specify the Content Security Policy which is passed to Helmet.
|
2022-08-03 21:46:41 +01:00
|
|
|
For configuration details see <https://helmetjs.github.io/docs/csp/>.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
protocolUseSSL = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Enable to use TLS for resource paths.
|
2022-07-28 22:19:15 +01:00
|
|
|
This only applies when {option}`domain` is set.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
urlAddPort = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Enable to add the port to callback URLs.
|
2022-07-28 22:19:15 +01:00
|
|
|
This only applies when {option}`domain` is set
|
2018-08-19 17:08:07 +01:00
|
|
|
and only for ports other than 80 and 443.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
useCDN = mkOption {
|
|
|
|
type = types.bool;
|
2020-02-28 10:57:27 +00:00
|
|
|
default = false;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Whether to use CDN resources or not.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
allowAnonymous = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Whether to allow anonymous usage.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
allowAnonymousEdits = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = ''
|
2022-08-13 10:56:56 +01:00
|
|
|
Whether to allow guests to edit existing notes with the <literal>freely</literal> permission,
|
2018-08-19 17:08:07 +01:00
|
|
|
when <option>allowAnonymous</option> is enabled.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
allowFreeURL = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Whether to allow note creation by accessing a nonexistent note URL.
|
|
|
|
'';
|
|
|
|
};
|
2022-05-14 16:58:17 +01:00
|
|
|
requireFreeURLAuthentication = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2022-05-14 16:58:17 +01:00
|
|
|
Whether to require authentication for FreeURL mode style note creation.
|
|
|
|
'';
|
|
|
|
};
|
2018-08-19 17:08:07 +01:00
|
|
|
defaultPermission = mkOption {
|
|
|
|
type = types.enum [ "freely" "editable" "limited" "locked" "private" ];
|
|
|
|
default = "editable";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Default permissions for notes.
|
|
|
|
This only applies for signed-in users.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
dbURL = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
|
|
|
example = ''
|
|
|
|
postgres://user:pass@host:5432/dbname
|
|
|
|
'';
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Specify which database to use.
|
2020-11-29 17:51:50 +00:00
|
|
|
HedgeDoc supports mysql, postgres, sqlite and mssql.
|
2022-07-28 22:19:15 +01:00
|
|
|
See [
|
|
|
|
https://sequelize.readthedocs.io/en/v3/](https://sequelize.readthedocs.io/en/v3/) for more information.
|
|
|
|
Note: This option overrides {option}`db`.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
db = mkOption {
|
|
|
|
type = types.attrs;
|
|
|
|
default = {};
|
2021-10-03 17:06:03 +01:00
|
|
|
example = literalExpression ''
|
2018-08-19 17:08:07 +01:00
|
|
|
{
|
|
|
|
dialect = "sqlite";
|
2020-11-29 17:51:50 +00:00
|
|
|
storage = "/var/lib/${name}/db.${name}.sqlite";
|
2018-08-19 17:08:07 +01:00
|
|
|
}
|
|
|
|
'';
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Specify the configuration for sequelize.
|
2020-11-29 17:51:50 +00:00
|
|
|
HedgeDoc supports mysql, postgres, sqlite and mssql.
|
2022-07-28 22:19:15 +01:00
|
|
|
See [
|
|
|
|
https://sequelize.readthedocs.io/en/v3/](https://sequelize.readthedocs.io/en/v3/) for more information.
|
|
|
|
Note: This option overrides {option}`db`.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
sslKeyPath= mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2020-11-29 17:51:50 +00:00
|
|
|
example = "/var/lib/hedgedoc/hedgedoc.key";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
|
|
|
Path to the SSL key. Needed when {option}`useSSL` is enabled.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
sslCertPath = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2020-11-29 17:51:50 +00:00
|
|
|
example = "/var/lib/hedgedoc/hedgedoc.crt";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
|
|
|
Path to the SSL cert. Needed when {option}`useSSL` is enabled.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
sslCAPath = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
2020-11-29 17:51:50 +00:00
|
|
|
example = [ "/var/lib/hedgedoc/ca.crt" ];
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
|
|
|
SSL ca chain. Needed when {option}`useSSL` is enabled.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
dhParamPath = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2020-11-29 17:51:50 +00:00
|
|
|
example = "/var/lib/hedgedoc/dhparam.pem";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
|
|
|
Path to the SSL dh params. Needed when {option}`useSSL` is enabled.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
tmpPath = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "/tmp";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2020-11-29 17:51:50 +00:00
|
|
|
Path to the temp directory HedgeDoc should use.
|
2022-07-28 22:19:15 +01:00
|
|
|
Note that {option}`serviceConfig.PrivateTmp` is enabled for
|
2020-11-29 17:51:50 +00:00
|
|
|
the HedgeDoc systemd service by default.
|
|
|
|
(Non-canonical paths are relative to HedgeDoc's base directory)
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
defaultNotePath = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = "./public/default.md";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Path to the default Note file.
|
2020-11-29 17:51:50 +00:00
|
|
|
(Non-canonical paths are relative to HedgeDoc's base directory)
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
docsPath = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = "./public/docs";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Path to the docs directory.
|
2020-11-29 17:51:50 +00:00
|
|
|
(Non-canonical paths are relative to HedgeDoc's base directory)
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
indexPath = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = "./public/views/index.ejs";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Path to the index template file.
|
2020-11-29 17:51:50 +00:00
|
|
|
(Non-canonical paths are relative to HedgeDoc's base directory)
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
hackmdPath = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = "./public/views/hackmd.ejs";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Path to the hackmd template file.
|
2020-11-29 17:51:50 +00:00
|
|
|
(Non-canonical paths are relative to HedgeDoc's base directory)
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
errorPath = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2021-10-03 17:06:03 +01:00
|
|
|
defaultText = literalExpression "./public/views/error.ejs";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Path to the error template file.
|
2020-11-29 17:51:50 +00:00
|
|
|
(Non-canonical paths are relative to HedgeDoc's base directory)
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
prettyPath = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2021-10-03 17:06:03 +01:00
|
|
|
defaultText = literalExpression "./public/views/pretty.ejs";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Path to the pretty template file.
|
2020-11-29 17:51:50 +00:00
|
|
|
(Non-canonical paths are relative to HedgeDoc's base directory)
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
slidePath = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2021-10-03 17:06:03 +01:00
|
|
|
defaultText = literalExpression "./public/views/slide.hbs";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Path to the slide template file.
|
2020-11-29 17:51:50 +00:00
|
|
|
(Non-canonical paths are relative to HedgeDoc's base directory)
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
uploadsPath = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "${cfg.workDir}/uploads";
|
2021-10-03 17:06:03 +01:00
|
|
|
defaultText = literalExpression "/var/lib/${name}/uploads";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Path under which uploaded files are saved.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
sessionName = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "connect.sid";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Specify the name of the session cookie.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
sessionSecret = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Specify the secret used to sign the session cookie.
|
|
|
|
If unset, one will be generated on startup.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
sessionLife = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 1209600000;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Session life time in milliseconds.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
heartbeatInterval = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 5000;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Specify the socket.io heartbeat interval.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
heartbeatTimeout = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 10000;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Specify the socket.io heartbeat timeout.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
documentMaxLength = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 100000;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Specify the maximum document length.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
email = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Whether to enable email sign-in.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
allowEmailRegister = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2020-07-04 14:15:26 +01:00
|
|
|
Whether to enable email registration.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
allowGravatar = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Whether to use gravatar as profile picture source.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
imageUploadType = mkOption {
|
|
|
|
type = types.enum [ "imgur" "s3" "minio" "filesystem" ];
|
|
|
|
default = "filesystem";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Specify where to upload images.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
minio = mkOption {
|
|
|
|
type = types.nullOr (types.submodule {
|
|
|
|
options = {
|
|
|
|
accessKey = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Minio access key.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
secretKey = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Minio secret key.
|
|
|
|
'';
|
|
|
|
};
|
2022-05-14 16:58:17 +01:00
|
|
|
endPoint = mkOption {
|
2018-08-19 17:08:07 +01:00
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Minio endpoint.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
port = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 9000;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Minio listen port.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
secure = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Whether to use HTTPS for Minio.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc "Configure the minio third-party integration.";
|
2018-08-19 17:08:07 +01:00
|
|
|
};
|
|
|
|
s3 = mkOption {
|
|
|
|
type = types.nullOr (types.submodule {
|
|
|
|
options = {
|
|
|
|
accessKeyId = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
AWS access key id.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
secretAccessKey = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
AWS access key.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
region = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
AWS S3 region.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc "Configure the s3 third-party integration.";
|
2018-08-19 17:08:07 +01:00
|
|
|
};
|
|
|
|
s3bucket = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
|
|
|
Specify the bucket name for upload types `s3` and `minio`.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
allowPDFExport = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Whether to enable PDF exports.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
imgur.clientId = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Imgur API client ID.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
azure = mkOption {
|
|
|
|
type = types.nullOr (types.submodule {
|
|
|
|
options = {
|
|
|
|
connectionString = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Azure Blob Storage connection string.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
container = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Azure Blob Storage container name.
|
|
|
|
It will be created if non-existent.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc "Configure the azure third-party integration.";
|
2018-08-19 17:08:07 +01:00
|
|
|
};
|
|
|
|
oauth2 = mkOption {
|
|
|
|
type = types.nullOr (types.submodule {
|
|
|
|
options = {
|
|
|
|
authorizationURL = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Specify the OAuth authorization URL.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
tokenURL = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Specify the OAuth token URL.
|
|
|
|
'';
|
|
|
|
};
|
2021-10-18 13:15:54 +01:00
|
|
|
baseURL = mkOption {
|
|
|
|
type = with types; nullOr str;
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2021-10-18 13:15:54 +01:00
|
|
|
Specify the OAuth base URL.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
userProfileURL = mkOption {
|
|
|
|
type = with types; nullOr str;
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2021-10-18 13:15:54 +01:00
|
|
|
Specify the OAuth userprofile URL.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
userProfileUsernameAttr = mkOption {
|
|
|
|
type = with types; nullOr str;
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2021-10-18 13:15:54 +01:00
|
|
|
Specify the name of the attribute for the username from the claim.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
userProfileDisplayNameAttr = mkOption {
|
|
|
|
type = with types; nullOr str;
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2021-10-18 13:15:54 +01:00
|
|
|
Specify the name of the attribute for the display name from the claim.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
userProfileEmailAttr = mkOption {
|
|
|
|
type = with types; nullOr str;
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2021-10-18 13:15:54 +01:00
|
|
|
Specify the name of the attribute for the email from the claim.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
scope = mkOption {
|
|
|
|
type = with types; nullOr str;
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2021-10-18 13:15:54 +01:00
|
|
|
Specify the OAuth scope.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
providerName = mkOption {
|
|
|
|
type = with types; nullOr str;
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2021-10-18 13:15:54 +01:00
|
|
|
Specify the name to be displayed for this strategy.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
rolesClaim = mkOption {
|
|
|
|
type = with types; nullOr str;
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2021-10-18 13:15:54 +01:00
|
|
|
Specify the role claim name.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
accessRole = mkOption {
|
|
|
|
type = with types; nullOr str;
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2021-10-18 13:15:54 +01:00
|
|
|
Specify role which should be included in the ID token roles claim to grant access
|
|
|
|
'';
|
|
|
|
};
|
2018-08-19 17:08:07 +01:00
|
|
|
clientID = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Specify the OAuth client ID.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
clientSecret = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Specify the OAuth client secret.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc "Configure the OAuth integration.";
|
2018-08-19 17:08:07 +01:00
|
|
|
};
|
|
|
|
facebook = mkOption {
|
|
|
|
type = types.nullOr (types.submodule {
|
|
|
|
options = {
|
|
|
|
clientID = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Facebook API client ID.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
clientSecret = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Facebook API client secret.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc "Configure the facebook third-party integration";
|
2018-08-19 17:08:07 +01:00
|
|
|
};
|
|
|
|
twitter = mkOption {
|
|
|
|
type = types.nullOr (types.submodule {
|
|
|
|
options = {
|
|
|
|
consumerKey = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Twitter API consumer key.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
consumerSecret = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Twitter API consumer secret.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc "Configure the Twitter third-party integration.";
|
2018-08-19 17:08:07 +01:00
|
|
|
};
|
|
|
|
github = mkOption {
|
|
|
|
type = types.nullOr (types.submodule {
|
|
|
|
options = {
|
|
|
|
clientID = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
GitHub API client ID.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
clientSecret = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Github API client secret.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc "Configure the GitHub third-party integration.";
|
2018-08-19 17:08:07 +01:00
|
|
|
};
|
|
|
|
gitlab = mkOption {
|
|
|
|
type = types.nullOr (types.submodule {
|
|
|
|
options = {
|
|
|
|
baseURL = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
GitLab API authentication endpoint.
|
|
|
|
Only needed for other endpoints than gitlab.com.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
clientID = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
GitLab API client ID.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
clientSecret = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
GitLab API client secret.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
scope = mkOption {
|
|
|
|
type = types.enum [ "api" "read_user" ];
|
|
|
|
default = "api";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
GitLab API requested scope.
|
|
|
|
GitLab snippet import/export requires api scope.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc "Configure the GitLab third-party integration.";
|
2018-08-19 17:08:07 +01:00
|
|
|
};
|
|
|
|
mattermost = mkOption {
|
|
|
|
type = types.nullOr (types.submodule {
|
|
|
|
options = {
|
|
|
|
baseURL = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Mattermost authentication endpoint.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
clientID = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Mattermost API client ID.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
clientSecret = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Mattermost API client secret.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc "Configure the Mattermost third-party integration.";
|
2018-08-19 17:08:07 +01:00
|
|
|
};
|
|
|
|
dropbox = mkOption {
|
|
|
|
type = types.nullOr (types.submodule {
|
|
|
|
options = {
|
|
|
|
clientID = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Dropbox API client ID.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
clientSecret = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Dropbox API client secret.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
appKey = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Dropbox app key.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc "Configure the Dropbox third-party integration.";
|
2018-08-19 17:08:07 +01:00
|
|
|
};
|
|
|
|
google = mkOption {
|
|
|
|
type = types.nullOr (types.submodule {
|
|
|
|
options = {
|
|
|
|
clientID = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Google API client ID.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
clientSecret = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Google API client secret.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc "Configure the Google third-party integration.";
|
2018-08-19 17:08:07 +01:00
|
|
|
};
|
|
|
|
ldap = mkOption {
|
|
|
|
type = types.nullOr (types.submodule {
|
|
|
|
options = {
|
|
|
|
providerName = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Optional name to be displayed at login form, indicating the LDAP provider.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
url = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
example = "ldap://localhost";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
URL of LDAP server.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
bindDn = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Bind DN for LDAP access.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
bindCredentials = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Bind credentials for LDAP access.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
searchBase = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
example = "o=users,dc=example,dc=com";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
LDAP directory to begin search from.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
searchFilter = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
example = "(uid={{username}})";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
LDAP filter to search with.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
searchAttributes = mkOption {
|
2022-07-24 02:45:16 +01:00
|
|
|
type = types.nullOr (types.listOf types.str);
|
|
|
|
default = null;
|
2018-08-19 17:08:07 +01:00
|
|
|
example = [ "displayName" "mail" ];
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
LDAP attributes to search with.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
userNameField = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2020-11-29 17:51:50 +00:00
|
|
|
LDAP field which is used as the username on HedgeDoc.
|
2022-07-28 22:19:15 +01:00
|
|
|
By default {option}`useridField` is used.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
useridField = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
example = "uid";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2020-11-29 17:51:50 +00:00
|
|
|
LDAP field which is a unique identifier for users on HedgeDoc.
|
2018-08-19 17:08:07 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
tlsca = mkOption {
|
|
|
|
type = types.str;
|
2022-07-24 03:03:24 +01:00
|
|
|
default = "/etc/ssl/certs/ca-certificates.crt";
|
2018-08-19 17:08:07 +01:00
|
|
|
example = "server-cert.pem,root.pem";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Root CA for LDAP TLS in PEM format.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc "Configure the LDAP integration.";
|
2018-08-19 17:08:07 +01:00
|
|
|
};
|
|
|
|
saml = mkOption {
|
|
|
|
type = types.nullOr (types.submodule {
|
|
|
|
options = {
|
|
|
|
idpSsoUrl = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
example = "https://idp.example.com/sso";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
IdP authentication endpoint.
|
|
|
|
'';
|
|
|
|
};
|
2018-09-18 16:07:46 +01:00
|
|
|
idpCert = mkOption {
|
2018-09-18 17:23:03 +01:00
|
|
|
type = types.path;
|
2018-08-19 17:08:07 +01:00
|
|
|
example = "/path/to/cert.pem";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Path to IdP certificate file in PEM format.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
issuer = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Optional identity of the service provider.
|
|
|
|
This defaults to the server URL.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
identifierFormat = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Optional name identifier format.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
groupAttribute = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "";
|
|
|
|
example = "memberOf";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Optional attribute name for group list.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
externalGroups = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
|
|
|
example = [ "Temporary-staff" "External-users" ];
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Excluded group names.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
requiredGroups = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
2020-11-29 17:51:50 +00:00
|
|
|
example = [ "Hedgedoc-Users" ];
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Required group names.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
attribute = {
|
|
|
|
id = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "";
|
2022-08-14 08:03:30 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Attribute map for `id'.
|
|
|
|
Defaults to `NameID' of SAML response.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
username = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "";
|
2022-08-14 08:03:30 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-08-19 17:08:07 +01:00
|
|
|
Attribute map for `username'.
|
|
|
|
Defaults to `NameID' of SAML response.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
email = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "";
|
|
|
|
description = ''
|
2022-08-13 10:56:56 +01:00
|
|
|
Attribute map for <literal>email</literal>.
|
|
|
|
Defaults to <literal>NameID</literal> of SAML response if
|
2018-08-19 17:08:07 +01:00
|
|
|
<option>identifierFormat</option> has
|
|
|
|
the default value.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = null;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc "Configure the SAML integration.";
|
2018-08-19 17:08:07 +01:00
|
|
|
};
|
2022-06-02 16:38:06 +01:00
|
|
|
}; in lib.mkOption {
|
|
|
|
type = lib.types.submodule {
|
|
|
|
freeformType = settingsFormat.type;
|
|
|
|
inherit options;
|
|
|
|
};
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2022-06-02 16:38:06 +01:00
|
|
|
HedgeDoc configuration, see
|
2022-07-28 22:19:15 +01:00
|
|
|
<https://docs.hedgedoc.org/configuration/>
|
2022-06-02 16:38:06 +01:00
|
|
|
for documentation.
|
|
|
|
'';
|
2018-08-19 17:08:07 +01:00
|
|
|
};
|
2020-09-23 10:47:38 +01:00
|
|
|
|
|
|
|
environmentFile = mkOption {
|
|
|
|
type = with types; nullOr path;
|
|
|
|
default = null;
|
2020-11-29 17:51:50 +00:00
|
|
|
example = "/var/lib/hedgedoc/hedgedoc.env";
|
2020-09-23 10:47:38 +01:00
|
|
|
description = ''
|
2022-08-02 02:39:32 +01:00
|
|
|
Environment file as defined in <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
|
2020-09-23 10:47:38 +01:00
|
|
|
|
|
|
|
Secrets may be passed to the service without adding them to the world-readable
|
|
|
|
Nix store, by specifying placeholder variables as the option value in Nix and
|
|
|
|
setting these variables accordingly in the environment file.
|
|
|
|
|
|
|
|
<programlisting>
|
2020-11-29 17:51:50 +00:00
|
|
|
# snippet of HedgeDoc-related config
|
|
|
|
services.hedgedoc.configuration.dbURL = "postgres://hedgedoc:\''${DB_PASSWORD}@db-host:5432/hedgedocdb";
|
|
|
|
services.hedgedoc.configuration.minio.secretKey = "$MINIO_SECRET_KEY";
|
2020-09-23 10:47:38 +01:00
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
<programlisting>
|
|
|
|
# content of the environment file
|
|
|
|
DB_PASSWORD=verysecretdbpassword
|
|
|
|
MINIO_SECRET_KEY=verysecretminiokey
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
Note that this file needs to be available on the host on which
|
2020-11-29 17:51:50 +00:00
|
|
|
<literal>HedgeDoc</literal> is running.
|
2020-09-23 10:47:38 +01:00
|
|
|
'';
|
|
|
|
};
|
2020-11-13 15:14:41 +00:00
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
2020-11-29 17:51:50 +00:00
|
|
|
default = pkgs.hedgedoc;
|
2021-10-03 17:06:03 +01:00
|
|
|
defaultText = literalExpression "pkgs.hedgedoc";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2020-11-29 17:51:50 +00:00
|
|
|
Package that provides HedgeDoc.
|
2020-11-13 15:14:41 +00:00
|
|
|
'';
|
|
|
|
};
|
2022-06-02 16:38:06 +01:00
|
|
|
|
2018-08-19 17:08:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
assertions = [
|
2022-06-02 16:38:06 +01:00
|
|
|
{ assertion = cfg.settings.db == {} -> (
|
|
|
|
cfg.settings.dbURL != "" && cfg.settings.dbURL != null
|
2018-08-19 17:08:07 +01:00
|
|
|
);
|
2020-11-29 17:51:50 +00:00
|
|
|
message = "Database configuration for HedgeDoc missing."; }
|
2018-08-19 17:08:07 +01:00
|
|
|
];
|
2020-11-29 17:51:50 +00:00
|
|
|
users.groups.${name} = {};
|
|
|
|
users.users.${name} = {
|
|
|
|
description = "HedgeDoc service user";
|
|
|
|
group = name;
|
2018-08-19 17:08:07 +01:00
|
|
|
extraGroups = cfg.groups;
|
|
|
|
home = cfg.workDir;
|
|
|
|
createHome = true;
|
2019-10-12 21:25:28 +01:00
|
|
|
isSystemUser = true;
|
2018-08-19 17:08:07 +01:00
|
|
|
};
|
|
|
|
|
2020-11-29 17:51:50 +00:00
|
|
|
systemd.services.hedgedoc = {
|
|
|
|
description = "HedgeDoc Service";
|
2018-08-19 17:08:07 +01:00
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
after = [ "networking.target" ];
|
2020-09-23 10:47:38 +01:00
|
|
|
preStart = ''
|
|
|
|
${pkgs.envsubst}/bin/envsubst \
|
|
|
|
-o ${cfg.workDir}/config.json \
|
2022-06-02 16:38:06 +01:00
|
|
|
-i ${prettyJSON cfg.settings}
|
|
|
|
mkdir -p ${cfg.settings.uploadsPath}
|
2020-09-23 10:47:38 +01:00
|
|
|
'';
|
2018-08-19 17:08:07 +01:00
|
|
|
serviceConfig = {
|
|
|
|
WorkingDirectory = cfg.workDir;
|
2022-06-02 16:38:06 +01:00
|
|
|
StateDirectory = [ cfg.workDir cfg.settings.uploadsPath ];
|
2020-11-29 17:51:50 +00:00
|
|
|
ExecStart = "${cfg.package}/bin/hedgedoc";
|
2020-09-23 10:47:38 +01:00
|
|
|
EnvironmentFile = mkIf (cfg.environmentFile != null) [ cfg.environmentFile ];
|
2018-08-19 17:08:07 +01:00
|
|
|
Environment = [
|
2020-09-23 10:47:38 +01:00
|
|
|
"CMD_CONFIG_FILE=${cfg.workDir}/config.json"
|
2018-08-19 17:08:07 +01:00
|
|
|
"NODE_ENV=production"
|
|
|
|
];
|
|
|
|
Restart = "always";
|
2020-11-29 17:51:50 +00:00
|
|
|
User = name;
|
2018-08-19 17:08:07 +01:00
|
|
|
PrivateTmp = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|