nixos-config/common/constants.nix

111 lines
2.8 KiB
Nix
Raw Normal View History

2024-08-14 11:14:20 -07:00
{
config,
lib,
...
}:
2024-02-26 21:06:48 -08:00
with lib; {
2023-10-09 10:44:07 -07:00
options.constants = {
domain = mkOption {
type = types.str;
default = "invariantspace.com";
description = ''
2023-11-27 13:19:16 -08:00
The domain for all devices.
2023-10-09 10:44:07 -07:00
'';
};
homeDir = mkOption {
type = types.str;
default = "/home/${config.constants.userName}";
description = ''
2023-11-27 13:19:16 -08:00
The home directory for the default user.
2023-10-09 10:44:07 -07:00
'';
};
localhost = mkOption {
type = types.str;
default = "127.0.0.1";
description = ''
2023-11-27 13:19:16 -08:00
The localhost address.
'';
};
port = mkOption {
type = types.attrsOf types.port;
default = {
2024-04-12 13:04:17 -07:00
aria2 = 30206;
2023-12-06 21:46:16 -08:00
conduit = 29800;
2024-08-31 23:53:22 -07:00
coturn = 12616;
coturn-tls = 38313;
coturn-relay-udp-min = 17105;
coturn-relay-udp-max = 17184;
2023-12-06 21:46:16 -08:00
forgejo = 47674;
headscale = 27327;
2023-11-27 13:19:16 -08:00
http = 80;
https = 443;
jellyfin = 8096;
2024-04-12 12:05:44 -07:00
jellyseerr = 52660;
2024-01-31 11:06:40 -08:00
vault = 25487;
2023-11-27 13:19:16 -08:00
};
description = ''
The mapping from service to ports.
2023-10-09 10:44:07 -07:00
'';
};
postMaster = mkOption {
type = types.str;
default = "trivial@${config.constants.domain}";
description = ''
2023-11-27 13:19:16 -08:00
The post master email address.
2023-10-09 10:44:07 -07:00
'';
};
2024-03-03 00:11:51 -08:00
privateKeyFiles = mkOption {
type = types.listOf types.str;
2024-08-14 11:14:20 -07:00
default =
if config.services.openssh.enable
2024-08-31 23:53:22 -07:00
then map (key: key.path) config.services.openssh.hostKeys
2024-08-14 11:14:20 -07:00
else ["/root/.ssh/${config.networking.hostName}"];
2024-03-03 00:11:51 -08:00
description = ''
The private key files for sops.
'';
};
2023-10-09 10:44:07 -07:00
publicKeys = mkOption {
type = types.listOf types.str;
default = [
2024-12-09 04:12:16 +00:00
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHPT/zRq5fffcUmjxcwG2cTr09fOa9O4rBUb6ob2CyNy macronova"
2023-10-09 10:44:07 -07:00
];
description = ''
The public keys for SSH authentication.
'';
};
sopsFile = mkOption {
type = types.path;
default = ./secrets.yaml;
description = ''
The secrets file for device.
'';
};
2024-03-03 00:11:51 -08:00
syncthingDevices = mkOption {
type = types.attrsOf (types.attrsOf types.str);
default = {
blitzar.id = "KGCBCIZ-GG6KMQ2-FLK5BWW-GLCEDML-5LCI24S-UKO5UWL-HWNCPYX-ZWWD5AQ";
nebula.id = "NJXA5XS-2PSWECD-UHBV7JH-IR2RSWY-PRUPFTZ-AHL7IN6-RXSLZKB-2FUNRQH";
2024-03-17 12:40:09 -07:00
protostar.id = "RQBGBAP-TI2VGMA-IO6OOAC-5KDJJKC-5NH2HNW-VAKLHMS-2YCRRQU-QKXFXQM";
2024-12-09 04:12:16 +00:00
quasar.id = "4IZ2RNQ-YTRM4C5-54X2MBV-ZL6Q6FO-TDETMJD-LBV3GV5-CO25QQU-2MG4PQR";
2024-03-03 00:11:51 -08:00
};
description = ''
The device information for syncthing
'';
};
2023-10-09 10:44:07 -07:00
userName = mkOption {
type = types.str;
default = "macronova";
description = ''
2023-11-27 13:19:16 -08:00
The username across all devices.
2023-10-09 10:44:07 -07:00
'';
};
2024-03-03 00:11:51 -08:00
wildcard = mkOption {
type = types.str;
default = "0.0.0.0";
description = ''
The localhost address.
'';
};
2023-10-09 10:44:07 -07:00
};
}