nixos-config/common/constants.nix
2026-02-16 22:11:39 -08:00

170 lines
4.2 KiB
Nix

{
config,
lib,
...
}:
with lib; {
options.constants = {
domain = mkOption {
type = types.str;
default = "invariantspace.com";
description = ''
The domain for all devices.
'';
};
fullName = mkOption {
type = types.str;
default = "Sicheng Pan";
description = ''
The full name of the default user.
'';
};
gpgKeyId = mkOption {
type = types.str;
default = "0xCE969670FB4B4A56";
description = ''
The GPG key ID for signing.
'';
};
homeDir = mkOption {
type = types.str;
default = "/home/${config.constants.userName}";
description = ''
The home directory for the default user.
'';
};
homeServer = mkOption {
type = types.str;
default = "nebula";
description = ''
The hostname of the home server.
'';
};
locale = mkOption {
type = types.str;
default = "zh_CN.UTF-8";
description = ''
The default locale for all devices.
'';
};
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;
forgejo = 47674;
headscale = 27327;
http = 80;
https = 443;
jellyfin = 8096;
jellyseerr = 52660;
prowlarr = 30784;
radarr = 37196;
sonarr = 32438;
tailscale = 62662;
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.
'';
};
timeZone = mkOption {
type = types.str;
default = "America/Los_Angeles";
description = ''
The default timezone for all devices.
'';
};
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.
'';
};
zfsPoolOptions = mkOption {
type = types.attrsOf types.str;
default = {
ashift = "12";
autotrim = "on";
listsnapshots = "on";
};
description = ''
The default options for ZFS pools.
'';
};
zfsRootFsOptions = mkOption {
type = types.attrsOf types.str;
default = {
acltype = "posix";
atime = "off";
compression = "zstd";
dnodesize = "auto";
mountpoint = "none";
normalization = "formD";
xattr = "sa";
};
description = ''
The default root filesystem options for ZFS pools.
'';
};
wildcard = mkOption {
type = types.str;
default = "0.0.0.0";
description = ''
The wildcard address for binding to all interfaces.
'';
};
};
}