Remove fsr domain option and use the native networking ones #67

Merged
rouven0 merged 2 commits from domain-refactor into main 2023-09-17 20:31:04 +02:00
27 changed files with 54 additions and 77 deletions

View file

@ -52,7 +52,6 @@
./modules/course-management.nix ./modules/course-management.nix
./modules/gitea.nix ./modules/gitea.nix
{ {
fsr.domain = "ifsr.de";
sops.defaultSopsFile = ./secrets/quitte.yaml; sops.defaultSopsFile = ./secrets/quitte.yaml;
} }
]; ];

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }: { pkgs, ... }:
{ {
imports = imports =
@ -15,7 +15,6 @@
#boot.supportedFilesystems = [ "zfs" ]; #boot.supportedFilesystems = [ "zfs" ];
#boot.zfs.devNodes = "/dev/"; #boot.zfs.devNodes = "/dev/";
networking.hostName = "quitte"; # Define your hostname.
services.qemuGuest.enable = true; services.qemuGuest.enable = true;
# Set your time zone. # Set your time zone.

View file

@ -1,7 +1,7 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: { config, lib, modulesPath, ... }:
{ {
imports = imports =

View file

@ -1,4 +1,4 @@
{ pkgs, config, lib, ... }: { config, ... }:
let let
wireguard_port = 51820; wireguard_port = 51820;
in in
@ -11,7 +11,9 @@ in
networking = { networking = {
hostId = "a71c81fc"; hostId = "a71c81fc";
rdns = "quitte.ifsr.de"; domain = "ifsr.de";
hostName = "quitte";
rDNS = config.networking.fqdn;
enableIPv6 = true; enableIPv6 = true;
useDHCP = true; useDHCP = true;
interfaces.ens18.useDHCP = true; interfaces.ens18.useDHCP = true;

View file

@ -57,7 +57,7 @@ in
''; '';
extraMessagesConfig = '' extraMessagesConfig = ''
director = abel-dir = all, !skipped, !restored director = abel-dir = all, !skipped, !restored
mailcommand = "${bacula_package}/bin/bsmtp -f \"Bacula <bacula@${config.fsr.domain}>\" -s \"Bacula report" %r" mailcommand = "${bacula_package}/bin/bsmtp -f \"Bacula <bacula@${config.networking.domain}>\" -s \"Bacula report" %r"
mail = root+backup = all, !skipped mail = root+backup = all, !skipped
''; '';
director."abel-dir".password = "@${config.sops.secrets."bacula/password".path}"; director."abel-dir".password = "@${config.sops.secrets."bacula/password".path}";

View file

@ -1,7 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, ... }:
let let
# hostName = "kurse.${config.fsr.domain}"; hostName = "kurse.${config.networking.domain}";
hostName = "kurse.ifsr.de";
in in
{ {
sops.secrets = sops.secrets =
@ -22,15 +21,15 @@ in
adminPassFile = config.sops.secrets."course-management/adminpass".path; adminPassFile = config.sops.secrets."course-management/adminpass".path;
admins = [{ admins = [{
name = "Root iFSR"; name = "Root iFSR";
email = "root@${config.fsr.domain}"; email = "root@${config.networking.domain}";
}]; }];
database = { database = {
ENGINE = "django.db.backends.postgresql"; ENGINE = "django.db.backends.postgresql";
NAME = "course-management"; NAME = "course-management";
}; };
email = lib.mkDefault { email = lib.mkDefault {
fromEmail = "noreply@${config.fsr.domain}"; fromEmail = "noreply@${config.networking.domain}";
serverEmail = "root@${config.fsr.domain}"; serverEmail = "root@${config.networking.domain}";
}; };
}; };
}; };

View file

@ -1,6 +1,6 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
domain = "ftp.ifsr.de"; domain = "ftp.${config.networking.domain}";
in in
{ {
services.nginx.additionalModules = [ pkgs.nginxModules.fancyindex ]; services.nginx.additionalModules = [ pkgs.nginxModules.fancyindex ];

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
domain = "git.${config.fsr.domain}"; domain = "git.${config.networking.domain}";
giteaUser = "git"; giteaUser = "git";
in in
{ {
@ -38,7 +38,7 @@ in
server = { server = {
PROTOCOL = "http+unix"; PROTOCOL = "http+unix";
DOMAIN = domain; DOMAIN = domain;
SSH_DOMAIN = config.fsr.domain; SSH_DOMAIN = config.networking.domain;
ROOT_URL = "https://${domain}"; ROOT_URL = "https://${domain}";
OFFLINE_MODE = true; # disable use of CDNs OFFLINE_MODE = true; # disable use of CDNs
}; };
@ -46,7 +46,7 @@ in
service = { service = {
DISABLE_REGISTRATION = true; DISABLE_REGISTRATION = true;
ENABLE_NOTIFY_MAIL = true; ENABLE_NOTIFY_MAIL = true;
NO_REPLY_ADDRESS = "noreply.${config.fsr.domain}"; NO_REPLY_ADDRESS = "noreply.${config.networking.domain}";
}; };
"service.explore".DISABLE_USERS_PAGE = true; "service.explore".DISABLE_USERS_PAGE = true;
openid = { openid = {
@ -55,7 +55,7 @@ in
}; };
mailer = { mailer = {
ENABLED = true; ENABLED = true;
FROM = "\"iFSR Git\" <git@${config.fsr.domain}>"; FROM = "\"iFSR Git\" <git@${config.networking.domain}>";
SMTP_ADDR = "localhost"; SMTP_ADDR = "localhost";
SMTP_PORT = 25; SMTP_PORT = 25;
}; };

View file

@ -1,6 +1,6 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
domain = "pad.ifsr.de"; domain = "pad.${config.networking.domain}";
template = pkgs.writeText "hedgedoc-template.md" '' template = pkgs.writeText "hedgedoc-template.md" ''
--- ---
tags: listed tags: listed

View file

@ -1,6 +1,6 @@
{ config, ... }: { config, ... }:
let let
domain = "hydra.ifsr.de"; domain = "hydra.${config.networking.domain}";
in in
{ {
sops.secrets."hydra_ldap_search" = { owner = "hydra"; group = "hydra"; mode = "440"; }; sops.secrets."hydra_ldap_search" = { owner = "hydra"; group = "hydra"; mode = "440"; };

View file

@ -1,6 +1,6 @@
{ config, ... }: { config, ... }:
let let
domain = "kpp.ifsr.de"; domain = "kpp.${config.networking.domain}";
in in
{ {
services.kpp = { services.kpp = {

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
domain = "auth.${config.fsr.domain}"; domain = "auth.${config.networking.domain}";
seed = { seed = {
groups = [ groups = [
{ {
@ -55,7 +55,7 @@ in
services.portunus = { services.portunus = {
enable = true; enable = true;
package = pkgs.portunus.overrideAttrs (old: { package = pkgs.portunus.overrideAttrs (_old: {
patches = [ patches = [
./0001-update-user-validation-regex.patch ./0001-update-user-validation-regex.patch
./0002-both-ldap-and-ldaps.patch ./0002-both-ldap-and-ldaps.patch

View file

@ -1,8 +1,8 @@
{ config, pkgs, lib, ... }: { config, pkgs, ... }:
let let
hostname = "mail.${config.fsr.domain}"; hostname = "mail.${config.networking.domain}";
domain = config.fsr.domain; domain = config.networking.domain;
rspamd-domain = "rspamd.${config.fsr.domain}"; rspamd-domain = "rspamd.${config.networking.domain}";
dovecot-ldap-args = pkgs.writeText "ldap-args" '' dovecot-ldap-args = pkgs.writeText "ldap-args" ''
uris = ldap://localhost uris = ldap://localhost
dn = uid=search, ou=users, dc=ifsr, dc=de dn = uid=search, ou=users, dc=ifsr, dc=de
@ -84,8 +84,7 @@ in
config = { config = {
home_mailbox = "Maildir/"; home_mailbox = "Maildir/";
# hostname used in helo command. It is recommended to have this match the reverse dns entry # hostname used in helo command. It is recommended to have this match the reverse dns entry
# smtp_helo_name = "x8d1e1ea9.agdsn.tu-dresden.de"; smtp_helo_name = config.networking.rDNS;
smtp_helo_name = config.networking.rdns;
smtp_use_tls = true; smtp_use_tls = true;
# smtp_tls_security_level = "encrypt"; # smtp_tls_security_level = "encrypt";
smtpd_use_tls = true; smtpd_use_tls = true;
@ -235,7 +234,7 @@ in
}; };
opendkim = { opendkim = {
enable = true; enable = true;
domains = "csl:${config.fsr.domain}"; domains = "csl:${config.networking.domain}";
selector = config.networking.hostName; selector = config.networking.hostName;
configFile = pkgs.writeText "opendkim-config" '' configFile = pkgs.writeText "opendkim-config" ''
UMask 0117 UMask 0117

View file

@ -7,10 +7,10 @@
services.mailman = { services.mailman = {
enable = true; enable = true;
serve.enable = true; serve.enable = true;
webHosts = [ "lists.${config.fsr.domain}" ]; webHosts = [ "lists.${config.networking.domain}" ];
hyperkitty.enable = true; hyperkitty.enable = true;
enablePostfix = true; enablePostfix = true;
siteOwner = "mailman@${config.fsr.domain}"; siteOwner = "mailman@${config.networking.domain}";
settings = { settings = {
database = { database = {
class = "mailman.database.postgresql.PostgreSQLDatabase"; class = "mailman.database.postgresql.PostgreSQLDatabase";
@ -58,7 +58,7 @@
]; ];
ensureDatabases = [ "mailman" "mailmanweb" ]; ensureDatabases = [ "mailman" "mailmanweb" ];
}; };
services.nginx.virtualHosts."lists.${config.fsr.domain}" = { services.nginx.virtualHosts."lists.${config.networking.domain}" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
}; };

View file

@ -1,7 +1,7 @@
{ config, pkgs, lib, ... }: { config, pkgs, ... }:
let let
domainServer = "matrix.staging.ifsr.de"; domainServer = "matrix.staging.${config.networking.domain}";
domainClient = "chat.staging.ifsr.de"; domainClient = "chat.staging.${config.networking.domain}";
clientConfig = { clientConfig = {
"m.homeserver" = { "m.homeserver" = {

View file

@ -1,4 +1,4 @@
{ config, options, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
homeserverDomain = config.services.matrix-synapse.settings.server_name; homeserverDomain = config.services.matrix-synapse.settings.server_name;
registrationFileSynapse = "/var/lib/matrix-synapse/telegram-registration.yaml"; registrationFileSynapse = "/var/lib/matrix-synapse/telegram-registration.yaml";

View file

@ -1,7 +1,7 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
domain = "nc.staging.ifsr.de"; domain = "nc.staging.${config.networking.domain}";
legacy_domain = "oc.ifsr.de"; legacy_domain = "oc.${config.networking.domain}";
in in
{ {
sops.secrets = { sops.secrets = {

View file

@ -29,7 +29,7 @@
acceptTerms = true; acceptTerms = true;
defaults = { defaults = {
#server = "https://acme-staging-v02.api.letsencrypt.org/directory"; #server = "https://acme-staging-v02.api.letsencrypt.org/directory";
email = "root@ifsr.de"; email = "root@${config.networking.domain}";
}; };
}; };
security.pam.services.nginx.text = '' security.pam.services.nginx.text = ''

View file

@ -1,17 +1,5 @@
{ config, lib, ... }: with lib; { { lib, ... }: with lib; {
options.fsr = { options.networking.rDNS = mkOption {
enable_office_bloat = mkOption {
type = types.bool;
default = false;
description = "install heavy office bloat like texlive, okular, ...";
};
domain = mkOption {
type = types.str;
default = "ifsr.de";
description = "under which top level domain the services should run";
};
};
options.networking.rdns = mkOption {
type = types.str; type = types.str;
default = networking.fqdn; default = networking.fqdn;
description = "The reverse dns record known to be set for this host."; description = "The reverse dns record known to be set for this host.";

View file

@ -1,7 +1,7 @@
# php pad lister tool written by jonas # php pad lister tool written by jonas
{ pkgs, config, lib, ... }: { pkgs, config, lib, ... }:
let let
domain = "list.pad.ifsr.de"; domain = "list.pad.${config.networking.domain}";
in in
{ {
services.phpfpm.pools.padlist = { services.phpfpm.pools.padlist = {

View file

@ -1,7 +1,6 @@
{ config, pkgs, lib, ... }: { config, lib, ... }:
let let
sogo-hostname = "mail.${config.fsr.domain}"; sogo-hostname = "mail.${config.networking.domain}";
domain = config.fsr.domain;
in in
{ {
sops.secrets = { sops.secrets = {

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: { ... }:
{ {
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
sops.age.generateKey = false; sops.age.generateKey = false;

View file

@ -1,10 +1,9 @@
{ pkgs, config, ... }: { config, ... }:
{ {
services = { services = {
nginx = { nginx = {
virtualHosts = { virtualHosts = {
# "stream.${config.fsr.domain}" = { "stream.${config.networking.domain}" = {
"stream.ifsr.de" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/" = locations."/" =
@ -17,13 +16,6 @@
}; };
}; };
}; };
#streamConfig = ''
# server {
# listen 1935;
# proxy_pass [::1]:1935;
# proxy_buffer_size 32k;
#}
#'';
}; };
owncast = { owncast = {
enable = true; enable = true;

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, ... }:
let let
domain = "users.${config.fsr.domain}"; domain = "users.${config.networking.domain}";
port = 8083; port = 8083;
apacheUser = config.services.httpd.user; apacheUser = config.services.httpd.user;
in in

View file

@ -1,6 +1,6 @@
{ config, ... }: { config, ... }:
let let
domain = "vault.ifsr.de"; domain = "vault.${config.networking.domain}";
in in
{ {
sops.secrets."vaultwarden_env".owner = "vaultwarden"; sops.secrets."vaultwarden_env".owner = "vaultwarden";
@ -16,7 +16,7 @@ in
smtpHost = "127.0.0.1"; smtpHost = "127.0.0.1";
smtpPort = 25; smtpPort = 25;
smtpSSL = false; smtpSSL = false;
smtpFrom = "noreply@${config.fsr.domain}"; smtpFrom = "noreply@${config.networking.domain}";
smtpFromName = "iFSR Vaultwarden"; smtpFromName = "iFSR Vaultwarden";
}; };
}; };

View file

@ -31,13 +31,13 @@ in
services.nginx = { services.nginx = {
virtualHosts."www.${config.fsr.domain}" = { virtualHosts."www.${config.networking.domain}" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/".return = "301 $scheme://ifsr.de$request_uri"; locations."/".return = "301 $scheme://ifsr.de$request_uri";
}; };
virtualHosts."${config.fsr.domain}" = { virtualHosts."${config.networking.domain}" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
root = "/srv/web/ifsrde"; root = "/srv/web/ifsrde";

View file

@ -1,6 +1,6 @@
{ config, pkgs, lib, ... }: { config, pkgs, ... }:
let let
domain = "wiki.ifsr.de"; domain = "wiki.${config.networking.domain}";
listenPort = 8080; listenPort = 8080;
in in
{ {