selfprivacy-nixos-config/selfprivacy-module.nix

134 lines
3.6 KiB
Nix
Raw Permalink Normal View History

{ lib, ... }:
2021-11-15 10:02:05 +00:00
with lib;
{
options.selfprivacy = {
# General server options
2021-11-15 10:02:05 +00:00
hostname = mkOption {
description = "The hostname of the server.";
type = types.nullOr types.str;
2021-11-15 10:02:05 +00:00
};
domain = mkOption {
description = ''
Domain used by the server
'';
# 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 10:02:05 +00:00
};
timezone = mkOption {
description = ''
Timezone used by the server
'';
type = types.nullOr types.str;
2024-01-18 22:59:29 +00:00
default = "Etc/UTC";
};
autoUpgrade = {
enable = mkOption {
description = "Enable auto-upgrade of the server.";
2023-11-18 01:40:57 +00:00
default = false;
type = types.nullOr types.bool;
};
allowReboot = mkOption {
description = "Allow the server to reboot during the upgrade.";
default = false;
type = types.nullOr types.bool;
};
};
stateVersion = mkOption {
description = "State version of the server";
type = types.nullOr types.str;
default = null;
};
########################
# Server admin options #
########################
2021-11-15 10:02:05 +00:00
username = mkOption {
description = ''
Username that was defined at the initial setup process
'';
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
'';
type = types.nullOr types.str;
2021-11-15 10:02:05 +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);
default = [ ];
};
#############
# DNS #
#############
dns = {
provider = mkOption {
description = "DNS provider that was defined at the initial setup process.";
type = types.nullOr types.str;
};
useStagingACME = mkOption {
description = "Use staging ACME server. Default is false";
type = types.nullOr types.bool;
default = false;
};
};
server = {
provider = mkOption {
description = "Server provider that was defined at the initial setup process.";
type = types.str;
};
2021-11-15 10:02:05 +00:00
};
#########
# SSH #
#########
2021-11-15 13:35:04 +00:00
ssh = {
enable = mkOption {
default = true;
type = types.nullOr types.bool;
};
rootKeys = mkOption {
description = ''
Root SSH authorized keys
2021-11-15 13:35:04 +00:00
'';
type = types.nullOr (types.listOf types.str);
default = [ "" ];
2021-11-15 13:35:04 +00:00
};
passwordAuthentication = mkOption {
description = ''
Password authentication for SSH
'';
default = false;
2021-11-15 13:35:04 +00:00
type = types.nullOr types.bool;
};
2021-11-15 10:02:05 +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));
default = [ ];
2021-11-15 10:02: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;
description = "Whether to bind-mount vmail and sieve folders";
};
2021-11-15 10:02:05 +00:00
};
}