2025-02-03 00:56:12 +04:00
|
|
|
{ lib, ... }:
|
2021-11-15 13:02:05 +03:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
{
|
2023-11-16 04:00:11 +04:00
|
|
|
options.selfprivacy = {
|
2021-11-22 19:53:43 +03:00
|
|
|
# General server options
|
2021-11-15 13:02:05 +03:00
|
|
|
hostname = mkOption {
|
|
|
|
description = "The hostname of the server.";
|
2021-11-16 13:30:11 +03:00
|
|
|
type = types.nullOr types.str;
|
2021-11-15 13:02:05 +03:00
|
|
|
};
|
|
|
|
domain = mkOption {
|
|
|
|
description = ''
|
|
|
|
Domain used by the server
|
|
|
|
'';
|
2023-12-16 09:39:22 +04:00
|
|
|
# see: https://regexr.com/7p7ep, https://stackoverflow.com/a/26987741
|
|
|
|
type = lib.types.strMatching ''^(xn--)?[a-z0-9][a-z0-9_-]{0,61}[a-z0-9]{0,1}\.(xn--)?([a-z0-9\-]{1,61}|[a-z0-9-]{1,30}\.[a-z]{2,})$'';
|
2021-11-15 13:02:05 +03:00
|
|
|
};
|
2021-11-22 19:53:43 +03:00
|
|
|
timezone = mkOption {
|
|
|
|
description = ''
|
|
|
|
Timezone used by the server
|
|
|
|
'';
|
|
|
|
type = types.nullOr types.str;
|
2024-01-19 02:59:29 +04:00
|
|
|
default = "Etc/UTC";
|
2021-11-22 19:53:43 +03:00
|
|
|
};
|
|
|
|
autoUpgrade = {
|
|
|
|
enable = mkOption {
|
|
|
|
description = "Enable auto-upgrade of the server.";
|
2023-11-18 05:40:57 +04:00
|
|
|
default = false;
|
2021-11-22 19:53:43 +03:00
|
|
|
type = types.nullOr types.bool;
|
|
|
|
};
|
|
|
|
allowReboot = mkOption {
|
|
|
|
description = "Allow the server to reboot during the upgrade.";
|
|
|
|
default = false;
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
};
|
|
|
|
};
|
2025-02-03 01:35:21 +04:00
|
|
|
sso = {
|
|
|
|
enable = mkOption {
|
|
|
|
description = "Enable SSO.";
|
|
|
|
default = true;
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
};
|
|
|
|
debug = mkOption {
|
|
|
|
description = "Enable debug for SSO.";
|
|
|
|
default = false;
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
};
|
|
|
|
};
|
2023-12-22 19:33:24 +04:00
|
|
|
stateVersion = mkOption {
|
|
|
|
description = "State version of the server";
|
2023-12-22 23:04:03 +04:00
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2023-12-22 19:33:24 +04:00
|
|
|
};
|
2021-11-22 19:53:43 +03:00
|
|
|
########################
|
|
|
|
# Server admin options #
|
|
|
|
########################
|
2021-11-15 13:02:05 +03:00
|
|
|
username = mkOption {
|
|
|
|
description = ''
|
|
|
|
Username that was defined at the initial setup process
|
|
|
|
'';
|
2021-11-16 13:30:11 +03:00
|
|
|
type = types.nullOr types.str;
|
2021-11-15 13:02:05 +03:00
|
|
|
};
|
|
|
|
hashedMasterPassword = mkOption {
|
|
|
|
description = ''
|
|
|
|
Hash of the password that was defined at the initial setup process
|
|
|
|
'';
|
2021-11-16 13:30:11 +03:00
|
|
|
type = types.nullOr types.str;
|
2021-11-15 13:02:05 +03:00
|
|
|
};
|
2021-11-22 19:53:43 +03:00
|
|
|
sshKeys = mkOption {
|
|
|
|
description = ''
|
|
|
|
SSH keys of the user that was defined at the initial setup process
|
|
|
|
'';
|
2021-11-29 22:17:37 +03:00
|
|
|
type = types.nullOr (types.listOf types.str);
|
2021-11-22 19:53:43 +03:00
|
|
|
default = [ ];
|
|
|
|
};
|
|
|
|
#############
|
2023-12-16 09:39:22 +04:00
|
|
|
# DNS #
|
2021-11-22 19:53:43 +03:00
|
|
|
#############
|
2022-11-08 01:44:09 +03:00
|
|
|
dns = {
|
|
|
|
provider = mkOption {
|
2023-12-12 08:25:06 +04:00
|
|
|
description = "DNS provider that was defined at the initial setup process.";
|
2022-11-08 01:44:09 +03:00
|
|
|
type = types.nullOr types.str;
|
|
|
|
};
|
2022-11-16 11:02:20 +03:00
|
|
|
useStagingACME = mkOption {
|
|
|
|
description = "Use staging ACME server. Default is false";
|
|
|
|
type = types.nullOr types.bool;
|
2023-12-12 08:25:06 +04:00
|
|
|
default = false;
|
2022-11-16 11:02:20 +03:00
|
|
|
};
|
2025-04-27 09:10:43 +03:00
|
|
|
forceDisableDnsPropagationCheck = mkOption {
|
|
|
|
description = "Force disable DNS propagation check.";
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
default = false;
|
|
|
|
};
|
2022-11-08 01:44:09 +03:00
|
|
|
};
|
|
|
|
server = {
|
|
|
|
provider = mkOption {
|
2023-12-12 08:25:06 +04:00
|
|
|
description = "Server provider that was defined at the initial setup process.";
|
2023-12-16 09:39:22 +04:00
|
|
|
type = types.str;
|
2022-08-26 14:21:05 +04:00
|
|
|
};
|
2025-07-23 18:16:16 +03:00
|
|
|
rootPartition = mkOption {
|
|
|
|
description = "Root partition to use.";
|
|
|
|
type = types.nullOr types.str;
|
2025-07-25 12:40:49 +03:00
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
rootPartitionName = mkOption {
|
|
|
|
description = "Canonical root partition name.";
|
|
|
|
type = types.nullOr types.str;
|
2025-07-23 18:16:16 +03:00
|
|
|
default = null;
|
|
|
|
};
|
2021-11-15 13:02:05 +03:00
|
|
|
};
|
2021-11-22 19:53:43 +03:00
|
|
|
#########
|
|
|
|
# SSH #
|
|
|
|
#########
|
2021-11-15 16:35:04 +03:00
|
|
|
ssh = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = true;
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
};
|
|
|
|
rootKeys = mkOption {
|
|
|
|
description = ''
|
2023-12-12 08:25:06 +04:00
|
|
|
Root SSH authorized keys
|
2021-11-15 16:35:04 +03:00
|
|
|
'';
|
2021-11-16 13:30:11 +03:00
|
|
|
type = types.nullOr (types.listOf types.str);
|
2021-11-22 19:53:43 +03:00
|
|
|
default = [ "" ];
|
2021-11-15 16:35:04 +03:00
|
|
|
};
|
2021-11-15 13:02:05 +03:00
|
|
|
};
|
2021-11-22 19:53:43 +03:00
|
|
|
###########
|
|
|
|
# Users #
|
|
|
|
###########
|
2021-11-15 13:02:05 +03:00
|
|
|
users = mkOption {
|
|
|
|
description = ''
|
|
|
|
Users that will be created on the server
|
|
|
|
'';
|
2021-11-15 13:29:20 +03:00
|
|
|
type = types.nullOr (types.listOf (types.attrsOf types.anything));
|
2021-11-22 19:53:43 +03:00
|
|
|
default = [ ];
|
2021-11-15 13:02:05 +03:00
|
|
|
};
|
2022-08-26 14:21:05 +04:00
|
|
|
##############
|
|
|
|
# Volumes #
|
|
|
|
##############
|
|
|
|
volumes = mkOption {
|
|
|
|
description = ''
|
|
|
|
Volumes that will be created on the server
|
|
|
|
'';
|
|
|
|
type = types.nullOr (types.listOf (types.attrsOf types.anything));
|
|
|
|
default = [ ];
|
|
|
|
};
|
|
|
|
useBinds = mkOption {
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
default = false;
|
2023-11-10 07:10:06 +04:00
|
|
|
description = "Whether to bind-mount vmail and sieve folders";
|
2022-08-26 14:21:05 +04:00
|
|
|
};
|
2024-12-22 13:19:10 +03:00
|
|
|
################
|
|
|
|
# PostgreSQL #
|
|
|
|
################
|
|
|
|
postgresql = {
|
|
|
|
location = mkOption {
|
|
|
|
description = "Volume name where to store Postgres data.";
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
};
|
2025-01-31 14:24:05 +04:00
|
|
|
################
|
|
|
|
# passthrough #
|
|
|
|
################
|
|
|
|
passthru = mkOption {
|
|
|
|
type = types.submodule {
|
2025-02-03 00:56:12 +04:00
|
|
|
freeformType = with types; lazyAttrsOf (uniq unspecified);
|
2025-01-31 14:24:05 +04:00
|
|
|
options = { };
|
|
|
|
};
|
|
|
|
default = { };
|
|
|
|
visible = false;
|
|
|
|
description = ''
|
|
|
|
This attribute allows to share data between modules.
|
|
|
|
You can put whatever you want here.
|
|
|
|
'';
|
|
|
|
};
|
2025-04-25 14:21:44 +03:00
|
|
|
#################
|
|
|
|
# Workarounds #
|
|
|
|
#################
|
|
|
|
workarounds = {
|
|
|
|
deleteNextcloudAdmin = mkOption {
|
|
|
|
description = ''
|
|
|
|
Whether to delete an admin user, which is initially created
|
|
|
|
'';
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
};
|
|
|
|
};
|
2025-09-13 16:36:41 +03:00
|
|
|
|
|
|
|
#################
|
|
|
|
# Email #
|
|
|
|
#################
|
|
|
|
email = with lib; mkOption {
|
|
|
|
type = types.attrsOf (
|
|
|
|
types.submodule (
|
2025-09-16 17:11:03 +03:00
|
|
|
{ ... }: {
|
2025-09-13 16:36:41 +03:00
|
|
|
options = {
|
2025-09-16 19:08:15 +03:00
|
|
|
subdomain = mkOption {
|
2025-09-13 16:36:41 +03:00
|
|
|
type = with types; strMatching "[A-Za-z0-9][A-Za-z0-9\-]{0,61}[A-Za-z0-9]";
|
2025-09-16 19:08:15 +03:00
|
|
|
example = "myservice";
|
2025-09-13 16:36:41 +03:00
|
|
|
default = config.sp.domain;
|
2025-09-16 19:08:15 +03:00
|
|
|
description = "Subdomain to send emails from";
|
2025-09-13 16:36:41 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
systemdTargets = mkOption {
|
2025-09-16 19:30:19 +03:00
|
|
|
type = with types; listOf (strMatchig "[a-zA-Z0-9@%:_.\-]+[.](service|socket|device|mount|automount|swap|target|path|timer|scope|slice)");
|
2025-09-13 16:36:41 +03:00
|
|
|
default = [];
|
|
|
|
example = [ "generate-mastodon-email-password.service" ];
|
|
|
|
description = "Systemd target which generates password file.";
|
|
|
|
};
|
|
|
|
|
|
|
|
sendOnly = mkOption {
|
|
|
|
type = with types; bool;
|
|
|
|
default = true;
|
|
|
|
example = "false";
|
|
|
|
description = "Specifies if the account should be a send-only account. Emails sent to send-only accounts will be rejected.";
|
|
|
|
};
|
|
|
|
|
|
|
|
hashedPasswordFile = mkOption {
|
|
|
|
type = with types; str;
|
|
|
|
example = "/run/keys/mastodon/email_password";
|
|
|
|
description = "Path where a file containing password hash located.";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
description = ''
|
|
|
|
Don't use this option to create regular users!!!
|
|
|
|
|
|
|
|
This option gives modules possibility to create mailboxes to send emails, e.g. notifications or reminders.
|
|
|
|
'';
|
|
|
|
|
|
|
|
example = {
|
|
|
|
"noreply@mastodon.example.tld" = {
|
|
|
|
hashedPasswordFile = "/run/keys/mastodon/email_password";
|
|
|
|
systemdTargets = [ "generate-mastodon-email-password.service" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2021-11-15 13:02:05 +03:00
|
|
|
};
|
|
|
|
}
|