mauville: add variables to adjust host settings

This commit is contained in:
Aly Raffauf 2024-04-22 20:34:02 -04:00
parent 4fcd46cfa3
commit a8c61f43af

View file

@ -4,14 +4,21 @@
pkgs, pkgs,
lib, lib,
... ...
}: { }: let
email = "alyraffauf@gmail.com";
hostName = "mauville";
domain = "raffauflabs.com";
mediaDirectory = "/mnt/Media";
archiveDirectory = "/mnt/Archive";
openPorts = [80 443 51413 9091];
in {
imports = [./hardware-configuration.nix ./home.nix]; imports = [./hardware-configuration.nix ./home.nix];
# Bootloader. # Bootloader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "mauville"; # Define your hostname. networking.hostName = hostName; # Define your hostname.
alyraffauf = { alyraffauf = {
apps = { apps = {
@ -53,23 +60,23 @@
networking = { networking = {
firewall = { firewall = {
allowedTCPPorts = [80 443 51413 9091]; allowedTCPPorts = openPorts;
allowedUDPPorts = [51413]; allowedUDPPorts = openPorts;
}; };
# My router doesn't expose settings for NAT loopback # My router doesn't expose settings for NAT loopback
# So we have to use this workaround. # So we have to use this workaround.
extraHosts = '' extraHosts = ''
127.0.0.1 music.raffauflabs.com 127.0.0.1 music.${domain}
127.0.0.1 nixcache.raffauflabs.com 127.0.0.1 nixcache.${domain}
127.0.0.1 plex.raffauflabs.com 127.0.0.1 plex.${domain}
127.0.0.1 podcasts.raffauflabs.com 127.0.0.1 podcasts.${domain}
127.0.0.1 news.raffauflabs.com 127.0.0.1 news.${domain}
''; '';
}; };
security.acme = { security.acme = {
acceptTerms = true; acceptTerms = true;
defaults.email = "alyraffauf@gmail.com"; defaults.email = email;
}; };
services = { services = {
@ -79,7 +86,7 @@
recommendedTlsSettings = true; recommendedTlsSettings = true;
recommendedGzipSettings = true; recommendedGzipSettings = true;
virtualHosts."music.raffauflabs.com" = { virtualHosts."music.${domain}" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/" = { locations."/" = {
@ -91,7 +98,7 @@
}; };
}; };
virtualHosts."news.raffauflabs.com" = { virtualHosts."news.${domain}" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/" = { locations."/" = {
@ -107,7 +114,7 @@
}; };
}; };
virtualHosts."nixcache.raffauflabs.com" = { virtualHosts."nixcache.${domain}" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/".proxyPass = "http://${config.services.nix-serve.bindAddress}:${ locations."/".proxyPass = "http://${config.services.nix-serve.bindAddress}:${
@ -115,7 +122,7 @@
}"; }";
}; };
virtualHosts."plex.raffauflabs.com" = { virtualHosts."plex.${domain}" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/" = { locations."/" = {
@ -127,7 +134,7 @@
}; };
}; };
virtualHosts."podcasts.raffauflabs.com" = { virtualHosts."podcasts.${domain}" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/" = { locations."/" = {
@ -152,8 +159,8 @@
openFirewall = true; openFirewall = true;
shares = { shares = {
Media = { Media = {
comment = "Media @ ${config.networking.hostName}"; comment = "Media @ ${hostName}";
path = "/mnt/Media"; path = mediaDirectory;
browseable = "yes"; browseable = "yes";
"read only" = "no"; "read only" = "no";
"guest ok" = "yes"; "guest ok" = "yes";
@ -161,8 +168,8 @@
"directory mask" = "0755"; "directory mask" = "0755";
}; };
Archive = { Archive = {
comment = "Archive @ ${config.networking.hostName}"; comment = "Archive @ ${hostName}";
path = "/mnt/Archive"; path = archiveDirectory;
browseable = "yes"; browseable = "yes";
"read only" = "no"; "read only" = "no";
"guest ok" = "yes"; "guest ok" = "yes";