2021-11-15 10:02:05 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.userdata;
|
|
|
|
directionArg =
|
|
|
|
if cfg.direction == ""
|
|
|
|
then ""
|
|
|
|
else "--direction=${cfg.direction}";
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.services.userdata = {
|
2021-11-22 16:53:43 +00:00
|
|
|
# General server options
|
2021-11-15 10:02:05 +00:00
|
|
|
hostname = mkOption {
|
|
|
|
description = "The hostname of the server.";
|
2021-11-16 10:30:11 +00:00
|
|
|
type = types.nullOr types.str;
|
2021-11-15 10:02:05 +00:00
|
|
|
};
|
|
|
|
domain = mkOption {
|
|
|
|
description = ''
|
|
|
|
Domain used by the server
|
|
|
|
'';
|
2021-11-16 10:30:11 +00:00
|
|
|
type = types.nullOr types.str;
|
2021-11-15 10:02:05 +00:00
|
|
|
};
|
2021-11-22 16:53:43 +00:00
|
|
|
timezone = mkOption {
|
|
|
|
description = ''
|
|
|
|
Timezone used by the server
|
|
|
|
'';
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = "Europe/Uzhgorod";
|
|
|
|
};
|
|
|
|
autoUpgrade = {
|
|
|
|
enable = mkOption {
|
|
|
|
description = "Enable auto-upgrade of the server.";
|
|
|
|
default = true;
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
};
|
|
|
|
allowReboot = mkOption {
|
|
|
|
description = "Allow the server to reboot during the upgrade.";
|
|
|
|
default = false;
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
};
|
|
|
|
};
|
2023-03-17 11:50:54 +00:00
|
|
|
stateVersion = mkOption {
|
|
|
|
description = ''
|
|
|
|
State version of the server
|
|
|
|
'';
|
2023-03-17 12:10:47 +00:00
|
|
|
type = types.str;
|
2023-03-17 11:50:54 +00:00
|
|
|
default = "22.11";
|
|
|
|
};
|
2021-11-22 16:53:43 +00:00
|
|
|
########################
|
|
|
|
# Server admin options #
|
|
|
|
########################
|
2021-11-15 10:02:05 +00:00
|
|
|
username = mkOption {
|
|
|
|
description = ''
|
|
|
|
Username that was defined at the initial setup process
|
|
|
|
'';
|
2021-11-16 10:30:11 +00:00
|
|
|
type = types.nullOr types.str;
|
2021-11-15 10:02:05 +00:00
|
|
|
};
|
|
|
|
hashedMasterPassword = mkOption {
|
|
|
|
description = ''
|
|
|
|
Hash of the password that was defined at the initial setup process
|
|
|
|
'';
|
2021-11-16 10:30:11 +00:00
|
|
|
type = types.nullOr types.str;
|
2021-11-15 10:02:05 +00:00
|
|
|
};
|
2021-11-22 16:53:43 +00:00
|
|
|
sshKeys = mkOption {
|
|
|
|
description = ''
|
|
|
|
SSH keys of the user that was defined at the initial setup process
|
|
|
|
'';
|
2021-11-29 19:17:37 +00:00
|
|
|
type = types.nullOr (types.listOf types.str);
|
2021-11-22 16:53:43 +00:00
|
|
|
default = [ ];
|
|
|
|
};
|
|
|
|
###############
|
|
|
|
# API options #
|
|
|
|
###############
|
2021-11-16 10:28:16 +00:00
|
|
|
api = {
|
2021-11-16 14:08:58 +00:00
|
|
|
enableSwagger = mkOption {
|
|
|
|
default = true;
|
|
|
|
description = ''
|
|
|
|
Enable Swagger UI
|
|
|
|
'';
|
|
|
|
type = types.bool;
|
|
|
|
};
|
2022-01-14 00:43:26 +00:00
|
|
|
skippedMigrations = mkOption {
|
|
|
|
default = [ ];
|
|
|
|
description = ''
|
|
|
|
List of migrations that should be skipped
|
|
|
|
'';
|
|
|
|
type = types.listOf types.str;
|
|
|
|
};
|
2021-11-16 10:28:16 +00:00
|
|
|
};
|
2021-11-22 16:53:43 +00:00
|
|
|
#############
|
|
|
|
# Secrets #
|
|
|
|
#############
|
2022-11-07 22:44:09 +00:00
|
|
|
dns = {
|
|
|
|
provider = mkOption {
|
|
|
|
description = "DNS provider that was defined at the initial setup process. Default is ClOUDFLARE";
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
};
|
2022-11-16 08:02:20 +00:00
|
|
|
useStagingACME = mkOption {
|
|
|
|
description = "Use staging ACME server. Default is false";
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
};
|
2022-11-07 22:44:09 +00:00
|
|
|
};
|
|
|
|
backup = {
|
2021-11-15 10:02:05 +00:00
|
|
|
bucket = mkOption {
|
|
|
|
description = "Bucket name used for userdata backups";
|
2021-11-16 10:30:11 +00:00
|
|
|
type = types.nullOr types.str;
|
2021-11-15 10:02:05 +00:00
|
|
|
};
|
|
|
|
};
|
2022-11-07 22:44:09 +00:00
|
|
|
server = {
|
|
|
|
provider = mkOption {
|
|
|
|
description = "Server provider that was defined at the initial setup process. Default is HETZNER";
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
};
|
|
|
|
};
|
2021-11-22 16:53:43 +00:00
|
|
|
##############
|
|
|
|
# Services #
|
|
|
|
##############
|
2021-11-15 10:02:05 +00:00
|
|
|
bitwarden = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
};
|
2022-08-26 10:21:05 +00:00
|
|
|
location = mkOption {
|
|
|
|
default = "sda1";
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
email = {
|
|
|
|
location = mkOption {
|
|
|
|
default = "sda1";
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
};
|
2021-11-15 10:02:05 +00:00
|
|
|
};
|
|
|
|
gitea = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
};
|
2022-08-26 10:21:05 +00:00
|
|
|
location = mkOption {
|
|
|
|
default = "sda1";
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
};
|
2021-11-15 10:02:05 +00:00
|
|
|
};
|
|
|
|
nextcloud = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = true;
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
};
|
2022-08-26 10:21:05 +00:00
|
|
|
location = mkOption {
|
|
|
|
default = "sda1";
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
};
|
2021-11-15 10:02:05 +00:00
|
|
|
};
|
|
|
|
pleroma = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
};
|
2022-08-26 10:21:05 +00:00
|
|
|
location = mkOption {
|
|
|
|
default = "sda1";
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
};
|
2021-11-15 10:02:05 +00:00
|
|
|
};
|
|
|
|
jitsi = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
ocserv = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = true;
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
};
|
|
|
|
};
|
2021-11-22 16:53:43 +00:00
|
|
|
#########
|
|
|
|
# SSH #
|
|
|
|
#########
|
2021-11-15 13:35:04 +00:00
|
|
|
ssh = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = true;
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
};
|
|
|
|
rootKeys = mkOption {
|
|
|
|
description = ''
|
2021-11-16 14:08:58 +00:00
|
|
|
Root SSH Keys
|
2021-11-15 13:35:04 +00:00
|
|
|
'';
|
2021-11-16 10:30:11 +00:00
|
|
|
type = types.nullOr (types.listOf types.str);
|
2021-11-22 16:53:43 +00:00
|
|
|
default = [ "" ];
|
2021-11-15 13:35:04 +00:00
|
|
|
};
|
|
|
|
passwordAuthentication = mkOption {
|
|
|
|
description = ''
|
|
|
|
Password authentication for SSH
|
|
|
|
'';
|
|
|
|
default = true;
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
};
|
2021-11-15 10:02:05 +00:00
|
|
|
};
|
2021-11-22 16:53:43 +00:00
|
|
|
###########
|
|
|
|
# Users #
|
|
|
|
###########
|
2021-11-15 10:02:05 +00:00
|
|
|
users = mkOption {
|
|
|
|
description = ''
|
|
|
|
Users that will be created on the server
|
|
|
|
'';
|
2021-11-15 10:29:20 +00:00
|
|
|
type = types.nullOr (types.listOf (types.attrsOf types.anything));
|
2021-11-22 16:53:43 +00:00
|
|
|
default = [ ];
|
2021-11-15 10:02:05 +00:00
|
|
|
};
|
2022-08-26 10:21:05 +00: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;
|
|
|
|
};
|
2021-11-15 10:02:05 +00:00
|
|
|
};
|
|
|
|
}
|