nixos-config/common/constants.nix

112 lines
2.8 KiB
Nix

{
config,
lib,
...
}:
with lib; {
options.constants = {
domain = mkOption {
type = types.str;
default = "invariantspace.com";
description = ''
The domain for all devices.
'';
};
homeDir = mkOption {
type = types.str;
default = "/home/${config.constants.userName}";
description = ''
The home directory for the default user.
'';
};
localhost = mkOption {
type = types.str;
default = "127.0.0.1";
description = ''
The localhost address.
'';
};
port = mkOption {
type = types.attrsOf types.port;
default = {
aria2 = 30206;
conduit = 29800;
coturn = 12616;
coturn-tls = 38313;
coturn-relay-udp-min = 17105;
coturn-relay-udp-max = 17184;
forgejo = 47674;
headscale = 27327;
http = 80;
https = 443;
jellyfin = 8096;
jellyseerr = 52660;
prowlarr = 30784;
radarr = 37196;
sonarr = 32438;
vault = 25487;
};
description = ''
The mapping from service to ports.
'';
};
postMaster = mkOption {
type = types.str;
default = "${config.constants.userName}@${config.constants.domain}";
description = ''
The post master email address.
'';
};
privateKeyFiles = mkOption {
type = types.listOf types.str;
default =
if config.services.openssh.enable
then map (key: key.path) config.services.openssh.hostKeys
else ["/root/.ssh/${config.networking.hostName}"];
description = ''
The private key files for sops.
'';
};
publicKeys = mkOption {
type = types.listOf types.str;
default = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHPT/zRq5fffcUmjxcwG2cTr09fOa9O4rBUb6ob2CyNy macronova"
];
description = ''
The public keys for SSH authentication.
'';
};
sopsFile = mkOption {
type = types.path;
default = ./secrets.yaml;
description = ''
The secrets file for device.
'';
};
syncthingDevices = mkOption {
type = types.attrsOf (types.attrsOf types.str);
default = {
nebula.id = "NJXA5XS-2PSWECD-UHBV7JH-IR2RSWY-PRUPFTZ-AHL7IN6-RXSLZKB-2FUNRQH";
protostar.id = "TD6OQ6N-5UT7CQK-BSRRDEL-WEZI6QX-SFN7EQN-GWJH3TB-YLPKCM7-66FGOAP";
quasar.id = "4IZ2RNQ-YTRM4C5-54X2MBV-ZL6Q6FO-TDETMJD-LBV3GV5-CO25QQU-2MG4PQR";
};
description = ''
The device information for syncthing
'';
};
userName = mkOption {
type = types.str;
default = "macronova";
description = ''
The username across all devices.
'';
};
wildcard = mkOption {
type = types.str;
default = "0.0.0.0";
description = ''
The localhost address.
'';
};
};
}