Split domains into their own var file and update all files accordingly

This commit is contained in:
Jimbo 2024-10-24 23:42:09 -04:00
parent 47bf9a94cd
commit fe73fa0d1f
34 changed files with 143 additions and 117 deletions

View file

@ -13,6 +13,7 @@
../../../modules/home/utils/zsh
# Misc
../../../variables/domains
../../../variables/look/colors/purple
];
}

View file

@ -13,6 +13,7 @@
../../../modules/home/utils/zsh
# Misc
../../../variables/domains
../../../variables/look/colors/purple
];
}

View file

@ -1,8 +1,8 @@
{ pkgs, ... }:
{ config, ... }:
{
programs.git = {
enable = true;
userName = "Jimbo";
userEmail = "jimbo@jimbosfiles.com";
userEmail = "jimbo@${config.domains.jim2}";
};
}

View file

@ -4,20 +4,20 @@
enable = true;
protocol = "cloudflare";
use = "web, web=https://ipinfo.io/ip";
zone = "${config.secrets.jimDomain}";
zone = "${config.domains.jim1}";
username = "token";
passwordFile = "${pkgs.writeText "cloudflareapikey" config.secrets.flareApiKey}";
domains = [
"${config.secrets.jimDomain}"
"*.${config.secrets.jimDomain}"
"sv.${config.secrets.jimDomain}"
"git.${config.secrets.jimDomain}"
"rtmp.${config.secrets.jimDomain}"
"turn.${config.secrets.jimDomain}"
"dew.${config.secrets.jimDomain}"
"john.${config.secrets.jimDomain}"
"beta.${config.secrets.jimDomain}"
"rogue.${config.secrets.jimDomain}"
"${config.domains.jim1}"
"*.${config.domains.jim1}"
"sv.${config.domains.jim1}"
"git.${config.domains.jim1}"
"rtmp.${config.domains.jim1}"
"turn.${config.domains.jim1}"
"dew.${config.domains.jim1}"
"john.${config.domains.jim1}"
"beta.${config.domains.jim1}"
"rogue.${config.domains.jim1}"
];
};
}

View file

@ -4,7 +4,7 @@
nextcloud = {
enable = true;
package = pkgs.nextcloud29;
hostName = "cloud.${config.secrets.jimDomain}";
hostName = "cloud.${config.domains.jim1}";
datadir = "/mnt/nextcloud";
https = true;
config = {
@ -13,20 +13,20 @@
};
settings = {
trusted_proxies = [ "127.0.0.1" ];
trusted_domains = [ "cloud.${config.secrets.jimDomain}" ];
trusted_domains = [ "cloud.${config.domains.jim1}" ];
overwriteprotocol = "https";
mail_smtphost = "mx.${config.secrets.jimDomain}";
mail_domain = "${config.secrets.jimDomain}";
mail_smtphost = "mx.${config.domains.jim1}";
mail_domain = "${config.domains.jim1}";
mail_from_address = "noreply";
mail_smtpauth = "true";
mail_smtpname = "noreply@${config.secrets.jimDomain}";
mail_smtpname = "noreply@${config.domains.jim1}";
mail_smtppassword = config.secrets.noreplyPassword;
mail_smtpmode = "smtp";
mail_smtpport = 587;
};
};
nginx.virtualHosts."cloud.${config.secrets.jimDomain}" = {
nginx.virtualHosts."cloud.${config.domains.jim1}" = {
enableACME = true;
addSSL = true;
locations."/" = {

View file

@ -14,11 +14,11 @@
PHOTOPRISM_DATABASE_NAME = "photoprism";
PHOTOPRISM_DATABASE_SERVER = "/run/mysqld/mysqld.sock";
PHOTOPRISM_DATABASE_USER = "photoprism";
PHOTOPRISM_SITE_URL = "https://gallery.${config.secrets.jimDomain}";
PHOTOPRISM_SITE_URL = "https://gallery.${config.domains.jim1}";
PHOTOPRISM_SITE_TITLE = "Jimbo's PhotoPrism";
};
};
nginx.virtualHosts."gallery.${config.secrets.jimDomain}" = {
nginx.virtualHosts."gallery.${config.domains.jim1}" = {
enableACME = true;
forceSSL = true;
locations."/" = {

View file

@ -9,8 +9,8 @@
enable = true;
settings = {
server = {
DOMAIN = "git.${config.secrets.jimDomain}";
ROOT_URL = "https://git.${config.secrets.jimDomain}:443";
DOMAIN = "git.${config.domains.jim1}";
ROOT_URL = "https://git.${config.domains.jim1}:443";
HTTP_PORT = 3110;
SSH_PORT = 2299;
START_SSH_SERVER = true;
@ -20,9 +20,9 @@
};
mailer = {
ENABLED = true;
SMTP_ADDR = "mx.${config.secrets.jimDomain}";
FROM = "Jimbo's Git <noreply@${config.secrets.jimDomain}>";
USER = "noreply@${config.secrets.jimDomain}";
SMTP_ADDR = "mx.${config.domains.jim1}";
FROM = "Jimbo's Git <noreply@${config.domains.jim1}>";
USER = "noreply@${config.domains.jim1}";
PASSWD = config.secrets.noreplyPassword;
PROTOCOL = "smtps";
};

View file

@ -1,6 +1,6 @@
{ config, ... }:
{
services.nginx.virtualHosts."git.${config.secrets.jimDomain}" = {
services.nginx.virtualHosts."git.${config.domains.jim1}" = {
enableACME = true;
forceSSL = true;
locations."/" = {

View file

@ -8,7 +8,7 @@
icecast = {
enable = true;
listen.port = 265;
hostname = "icecast.${config.secrets.jimDomain}";
hostname = "icecast.${config.domains.jim1}";
admin = {
user = "jimbo";
password = "${config.secrets.castAdminPass}";
@ -19,7 +19,7 @@
</authentication>
<location>Canada</location>
<admin>jimbo@jimbosfiles.com</admin>
<admin>jimbo@${config.domains.jim2}</admin>
<mount type="normal">
<mount-name>/jimbops.opus</mount-name>

View file

@ -1,6 +1,6 @@
{ config, ... }:
{
services.nginx.virtualHosts."icecast.${config.secrets.jimDomain}" = {
services.nginx.virtualHosts."icecast.${config.domains.jim1}" = {
enableACME = true;
forceSSL = true;
locations."/" = {

View file

@ -2,9 +2,9 @@
{
services.roundcube = {
enable = true;
hostName = "mail.${config.secrets.jimDomain}";
hostName = "mail.${config.domains.jim1}";
extraConfig = ''
$config['smtp_server'] = "tls://mx.${config.secrets.jimDomain}";
$config['smtp_server'] = "tls://mx.${config.domains.jim1}";
$config['smtp_user'] = "%u";
$config['smtp_pass'] = "%p";
'';

View file

@ -8,46 +8,46 @@
mailserver = rec {
enable = true;
domains = [
"${config.secrets.jimDomain}"
"${config.secrets.jimDomain2}"
"${config.secrets.lunaDomain}"
"${config.secrets.cornDomain}"
"${config.domains.jim1}"
"${config.domains.jim2}"
"${config.domains.luna}"
"${config.domains.corn}"
];
fqdn = "mx.${config.secrets.jimDomain}";
fqdn = "mx.${config.domains.jim1}";
certificateScheme = "acme-nginx";
localDnsResolver = false;
redis.port = 1515;
dmarcReporting = {
enable = true;
domain = "${config.secrets.jimDomain}";
domain = "${config.domains.jim1}";
localpart = "noreply";
organizationName = "Jimbo's Files";
};
# A list of accounts, passwords generated with nix-shell -p mkpasswd --run 'mkpasswd -sm bcrypt'
loginAccounts = {
"noreply@${config.secrets.jimDomain}" = {
"noreply@${config.domains.jim1}" = {
hashedPasswordFile = pkgs.writeText "noreply" config.secrets.noreplyMailHash;
sendOnly = true;
};
"jimbo@${config.secrets.jimDomain2}" = {
"jimbo@${config.domains.jim12}" = {
hashedPasswordFile = pkgs.writeText "jimbo" config.secrets.jimboMailHash;
aliases = [
"jimbo@${config.secrets.jimDomain}"
"james@${config.secrets.jimDomain}"
"james@${config.secrets.jimDomain2}"
"contact@${config.secrets.jimDomain}"
"contact@${config.secrets.jimDomain2}"
"jimbo@${config.domains.jim1}"
"james@${config.domains.jim1}"
"james@${config.domains.jim2}"
"contact@${config.domains.jim1}"
"contact@${config.domains.jim2}"
];
};
"luna@${config.secrets.lunaDomain}" = {
"luna@${config.domains.luna}" = {
hashedPasswordFile = pkgs.writeText "luna" config.secrets.lunaMailHash;
};
"corn@${config.secrets.cornDomain}" = {
"corn@${config.domains.corn}" = {
hashedPasswordFile = pkgs.writeText "corn" config.secrets.cornMailHash;
};
"tiny@${config.secrets.cornDomain}" = {
"tiny@${config.domains.corn}" = {
hashedPasswordFile = pkgs.writeText "tiny" config.secrets.tinyMailHash;
};
};

View file

@ -1,6 +1,6 @@
{ pkgs, config, ... }:
{
services.nginx.virtualHosts."mx.${config.secrets.jimDomain}" = {
services.nginx.virtualHosts."mx.${config.domains.jim1}" = {
enableACME = true;
forceSSL = true;
locations."/" = {

View file

@ -43,7 +43,7 @@ in {
};
# BlueMap webhost
nginx.virtualHosts."john.${config.secrets.jimDomain}" = {
nginx.virtualHosts."john.${config.domains.jim1}" = {
enableACME = true;
forceSSL = true;
locations."/" = {
@ -52,16 +52,4 @@ in {
};
};
};
# Allow Nginx to read and write to paths
systemd.services.nginx.serviceConfig = {
ReadWritePaths = [ "/var/www/Jimbo-Landing-Page/streams/hls/" ];
};
# Open HTTP and HTTPs ports
networking.firewall = {
allowedTCPPorts = [
80 443 # Nginx
];
};
}

View file

@ -12,19 +12,19 @@ in {
server-port = 30014;
motd = "\\u00A7l\\u00A7bJimbo's \\u00A7cRoguecraft \\u00A7bserver.";
require-resource-pack = true;
resource-pack = "https://${config.secrets.jimDomain}/roguecraftresourcepackredir";
resource-pack = "https://${config.domains.jim1}/roguecraftresourcepackredir";
resource-pack-sha1 = "b540c0562aba90c3ead2356bb9cb74fcf0db36b3";
};
whitelist = common.whitelist;
symlinks = common.paperSymlinks;
files = common.configFiles // {
"world/datapacks/roguecraft.zip" = builtins.fetchurl {
url = "https://${config.secrets.jimDomain}/roguecraftdatapackredir";
url = "https://${config.domains.jim1}/roguecraftdatapackredir";
sha256 = "04zrkvzvi1i898al45fh9j3k635sf9qhwca7phbv4ynkfl8bz3q3";
};
};
};
nginx.virtualHosts."${config.secrets.jimDomain}".locations = {
nginx.virtualHosts."${config.domains.jim1}".locations = {
"/roguecraftdatapackredir" = {
return = "301 https://cdn.modrinth.com/data/HtKjVijx/versions/Rme4c23R/Roguecraft%201.2.6%20-%20Data%20Pack.zip";
};

View file

@ -40,11 +40,18 @@ in {
# Open ports for proxy
networking.firewall = {
# Server and info
allowedTCPPorts = [
25565 19132 30013 5657 # Minecraft server info
25565
19132
30013
5657
];
# Server, VC, and Bedrock
allowedUDPPorts = [
25565 19132 30013 # Minecraft server, VC, and Bedrock
25565
19132
30013
];
};
}

View file

@ -9,11 +9,11 @@
nginx.enable = true;
database.createLocally = true;
settings = {
hostname = "lemmy.${config.secrets.jimDomain}";
hostname = "lemmy.${config.domains.jim1}";
email = {
smtp_server = "mx.${config.secrets.jimDomain}:587";
smtp_login = "noreply@${config.secrets.jimDomain}";
smtp_from_address = "Jimbo's Lemmy <noreply@${config.secrets.jimDomain}>";
smtp_server = "mx.${config.domains.jim1}:587";
smtp_login = "noreply@${config.domains.jim1}";
smtp_from_address = "Jimbo's Lemmy <noreply@${config.domains.jim1}>";
smtp_password = config.secrets.noreplyPassword;
tls_type = "starttls";
};

View file

@ -1,6 +1,6 @@
{ config, ... }:
{
services.nginx.virtualHosts."lemmy.${config.secrets.jimDomain}" = {
services.nginx.virtualHosts."lemmy.${config.domains.jim1}" = {
enableACME = true;
forceSSL = true;
};

View file

@ -2,16 +2,16 @@
{
services.mastodon = {
enable = true;
localDomain = "social.${config.secrets.jimDomain}";
localDomain = "social.${config.domains.jim1}";
streamingProcesses = 4;
configureNginx = true;
smtp = {
createLocally = false;
host = "mx.${config.secrets.jimDomain}";
host = "mx.${config.domains.jim1}";
port = 587;
authenticate = true;
fromAddress = "Jimbo's Mastodon <noreply@${config.secrets.jimDomain}>";
user = "noreply@${config.secrets.jimDomain}";
fromAddress = "Jimbo's Mastodon <noreply@${config.domains.jim1}>";
user = "noreply@${config.domains.jim1}";
passwordFile = pkgs.writeText "smtp_pass.txt" config.secrets.noreplyPassword;
};
};

View file

@ -7,16 +7,16 @@
nixpkgs.config.element-web.conf = {
default_server_config = {
"m.homeserver" = {
base_url = "https://matrix.${config.secrets.jimDomain}";
server_name = "matrix.${config.secrets.jimDomain}";
base_url = "https://matrix.${config.domains.jim1}";
server_name = "matrix.${config.domains.jim1}";
};
};
branding = {
#welcome_background_url = "https://staging.${config.secrets.jimDomain}/images/backgrounds/bloxelcom-sunset.jpg";
#auth_header_logo_url = "https://staging.${config.secrets.jimDomain}/images/logos/bloxelcom.png";
#welcome_background_url = "https://staging.${config.domains.jim1}/images/backgrounds/template-background.png";
#auth_header_logo_url = "https://staging.${config.domains.jim1}/images/logos/template-logo.png";
};
embedded_pages = {
home_url = "https://www.${config.secrets.jimDomain}/";
home_url = "https://www.${config.domains.jim1}/";
};
disable_custom_urls = true;
disable_guests = true;

View file

@ -1,6 +1,6 @@
{ pkgs, config, ... }:
{
services.nginx.virtualHosts."chat.${config.secrets.jimDomain}" = {
services.nginx.virtualHosts."chat.${config.domains.jim1}" = {
enableACME = true;
addSSL = true;
root = "${pkgs.element-web}";

View file

@ -13,16 +13,16 @@
max-port = 50000;
use-auth-secret = true;
static-auth-secret = "will be world readable for local users :(";
realm = "turn.${config.secrets.jimDomain}";
cert = "/var/lib/acme/turn.${config.secrets.jimDomain}.com/fullchain.pem";
pkey = "/var/lib/acme/turn.${config.secrets.jimDomain}.com/key.pem";
realm = "turn.${config.domains.jim1}";
cert = "/var/lib/acme/turn.${config.domains.jim1}.com/fullchain.pem";
pkey = "/var/lib/acme/turn.${config.domains.jim1}.com/key.pem";
};
# Enable coturn on Synapse
matrix-synapse.settings = {
turn_uris = [
"turn:turn.${config.secrets.jimDomain}:3478?transport=udp"
"turn:turn.${config.secrets.jimDomain}:3478?transport=tcp"
"turn:turn.${config.domains.jim1}:3478?transport=udp"
"turn:turn.${config.domains.jim1}:3478?transport=tcp"
];
turn_shared_secret = config.services.coturn.static-auth-secret;
turn_user_lifetime = "1h";

View file

@ -1,6 +1,6 @@
{ config, ... }:
{
services.nginx.virtualHosts."turn.${config.secrets.jimDomain}" = {
services.nginx.virtualHosts."turn.${config.domains.jim1}" = {
enableACME = true;
forceSSL = true;
listen = [{
@ -12,7 +12,7 @@
};
security.acme.certs = {
"turn.${config.secrets.jimDomain}" = {
"turn.${config.domains.jim1}" = {
group = "turnserver";
postRun = "systemctl restart coturn.service";
};

View file

@ -9,8 +9,8 @@
services.matrix-synapse = {
enable = true;
settings = {
server_name = "${config.secrets.jimDomain}";
public_baseurl = "https://matrix.${config.secrets.jimDomain}";
server_name = "${config.domains.jim1}";
public_baseurl = "https://matrix.${config.domains.jim1}";
suppress_key_server_warning = true;
listeners = [{
@ -23,9 +23,9 @@
}];
email = {
notif_from = "Jimbo's Matrix <noreply@${config.secrets.jimDomain}>";
smtp_host = "mx.${config.secrets.jimDomain}";
smtp_user = "noreply@${config.secrets.jimDomain}";
notif_from = "Jimbo's Matrix <noreply@${config.domains.jim1}>";
smtp_host = "mx.${config.domains.jim1}";
smtp_user = "noreply@${config.domains.jim1}";
smtp_pass = config.secrets.noreplyPassword;
enable_tls = true;
smtp_port = 587;
@ -36,10 +36,24 @@
registrations_require_3pid = [ "email" ];
# Allow only this range of emails
allowed_local_3pids = [{
medium = "email";
pattern = "^[^@]+@jimbosfiles\\.com$";
}];
allowed_local_3pids = [
{
medium = "email";
pattern = ''^[^@]+@jimbosfiles\.com$'';
}
{
medium = "email";
pattern = ''^[^@]+@nixfox\.ca$'';
}
{
medium = "email";
pattern = ''^[^@]+@freecorn1854\.win$'';
}
{
medium = "email";
pattern = ''^[^@]+@lunamoonlight\.xyz$'';
}
];
# Set the type of database
database.name = "sqlite3";

View file

@ -1,6 +1,6 @@
{ config, ... }:
{
services.nginx.virtualHosts."matrix.${config.secrets.jimDomain}" = {
services.nginx.virtualHosts."matrix.${config.domains.jim1}" = {
enableACME = true;
forceSSL = true;
locations = {

View file

@ -3,7 +3,7 @@
services.matrix-sliding-sync = {
enable = true;
settings = {
SYNCV3_SERVER = "https://matrix.${config.secrets.jimDomain}";
SYNCV3_SERVER = "https://matrix.${config.domains.jim1}";
SYNCV3_BINDADDR = "0.0.0.0:8009";
};
environmentFile = "${pkgs.writeText "matrixsecret" ''

View file

@ -1,6 +1,6 @@
{ config, ... }:
{
services.nginx.virtualHosts."live.${config.secrets.jimDomain}" = {
services.nginx.virtualHosts."live.${config.domains.jim1}" = {
enableACME = true;
forceSSL = true;
locations."/" = {

View file

@ -2,12 +2,12 @@
{
services.pixelfed = {
enable = true;
domain = "pics.${config.secrets.jimDomain}";
domain = "pics.${config.domains.jim1}";
secretFile = pkgs.writeText "appkey" config.secrets.pixelfedKey;
settings = {
APP_NAME = ''"Jimbo's Pixelfed"'';
INSTANCE_DESCRIPTION = ''"The Jimbosfiles Pixelfed Instance"'';
INSTANCE_CONTACT_EMAIL = "jimbo@${config.secrets.jimDomain}";
INSTANCE_CONTACT_EMAIL = "jimbo@${config.domains.jim1}";
OPEN_REGISTRATION = true;
APP_LOCALE = "en";
INSTANCE_DISCOVER_PUBLIC = false;
@ -15,13 +15,13 @@
# Mail config
ENFORCE_EMAIL_VERIFICATION = true;
MAIL_FROM_ADDRESS = "noreply@${config.secrets.jimDomain}";
MAIL_FROM_NAME = ''"Jimbo's Pixelfed <noreply@${config.secrets.jimDomain}>"'';
MAIL_FROM_ADDRESS = "noreply@${config.domains.jim1}";
MAIL_FROM_NAME = ''"Jimbo's Pixelfed <noreply@${config.domains.jim1}>"'';
MAIL_ENCRYPTION = "tls";
MAIL_DRIVER = "smtp";
MAIL_HOST = "mx.${config.secrets.jimDomain}";
MAIL_HOST = "mx.${config.domains.jim1}";
MAIL_PORT = 587;
MAIL_USERNAME = "noreply@${config.secrets.jimDomain}";
MAIL_USERNAME = "noreply@${config.domains.jim1}";
MAIL_PASSWORD = "${config.secrets.noreplyPassword}";
};
nginx = {

View file

@ -1,6 +1,6 @@
{ config, ... }:
{
services.nginx.virtualHosts."torrent.${config.secrets.jimDomain}" = {
services.nginx.virtualHosts."torrent.${config.domains.jim1}" = {
enableACME = true;
forceSSL = true;
locations."/" = {

View file

@ -7,17 +7,17 @@
services.vaultwarden = {
enable = true;
config = {
DOMAIN = "https://warden.${config.secrets.jimDomain}";
DOMAIN = "https://warden.${config.domains.jim1}";
SIGNUPS_ALLOWED = false;
ROCKET_ADDRESS = "127.0.0.1";
ROCKET_PORT = 8222;
ROCKET_LOG = "critical";
# Smtp email
SMTP_HOST = "mx.${config.secrets.jimDomain}";
SMTP_FROM = "Jimbo's Vaultwarden <noreply@${config.secrets.jimDomain}>";
SMTP_HOST = "mx.${config.domains.jim1}";
SMTP_FROM = "noreply@${config.domains.jim1}";
SMTP_FROM_NAME = "Vaultwarden";
SMTP_USERNAME = "noreply@${config.secrets.jimDomain}";
SMTP_USERNAME = "noreply@${config.domains.jim1}";
SMTP_PASSWORD = config.secrets.noreplyPassword;
SMTP_SECURITY = "starttls";
SMTP_PORT = 587;

View file

@ -1,6 +1,6 @@
{ config, ... }:
{
services.nginx.virtualHosts."warden.${config.secrets.jimDomain}" = {
services.nginx.virtualHosts."warden.${config.domains.jim1}" = {
enableACME = true;
forceSSL = true;
locations."/" = {

View file

@ -1,7 +1,7 @@
{ pkgs, config, ... }:
{
services.nginx.virtualHosts = {
"${config.secrets.jimDomain}" = {
"${config.domains.jim1}" = {
enableACME = true;
addSSL = true;
root = "/var/www/Jimbo-Landing-Page";
@ -12,13 +12,13 @@
return 200 '
{
"m.homeserver": {
"base_url": "https://matrix.${config.secrets.jimDomain}"
"base_url": "https://matrix.${config.domains.jim1}"
},
"m.identity_server": {
"base_url": "https://matrix.org"
},
"org.matrix.msc3575.proxy": {
"url": "https://matrix.${config.secrets.jimDomain}"
"url": "https://matrix.${config.domains.jim1}"
}
}';
'';
@ -26,7 +26,7 @@
"/.well-known/matrix/server" = {
extraConfig = ''
default_type application/json;
return 200 '{"m.server": "matrix.${config.secrets.jimDomain}:443"}';
return 200 '{"m.server": "matrix.${config.domains.jim1}:443"}';
'';
};
};

View file

@ -2,6 +2,7 @@
{
imports = [
./displays
./domains
./ips
./look
./secrets

View file

@ -0,0 +1,14 @@
{ lib, config, ... }:
{
options.domains = lib.mkOption {
type = lib.types.attrs;
default = {};
};
config.domains = {
jim1 = "jimbosfiles.com";
jim2 = "nixfox.ca";
corn = "freecorn1854.win";
luna = "lunamoonlight.xyz";
};
}