move server module loading to modules folder

This commit is contained in:
Grimmauld 2024-05-09 11:03:43 +02:00
parent 730195c67c
commit aa06c9b3e9
Signed by: Grimmauld
GPG Key ID: C2946668769F91FB
4 changed files with 65 additions and 63 deletions

View File

@ -23,19 +23,7 @@ let
grimmauld-nixos-server = [ grimmauld-nixos-server = [
./specific/grimmauld-nixos-server/configuration.nix ./specific/grimmauld-nixos-server/configuration.nix
./modules/letsencrypt.nix ./modules
./modules/matrix.nix
./modules/puffer.nix
./modules/gitea.nix
./modules/grafana.nix
./modules/nextcloud.nix
./modules/prometheus.nix
# ./modules/mjolnir.nix
./modules/fail2ban.nix
./modules/email.nix
./modules/discord-matrix-bridge.nix
./modules/mastodon.nix
]; ];
}; };

59
modules/default.nix Normal file
View File

@ -0,0 +1,59 @@
{
lib,
config,
inputs,
pkgs,
...
}:
let
inherit (config.networking) domain;
root_email = "contact@${domain}";
in
{
imports = [
./matrix.nix
./puffer.nix
./gitea.nix
./grafana.nix
./nextcloud.nix
./prometheus.nix
# ./mjolnir.nix
./fail2ban.nix
./email.nix
./discord-matrix-bridge.nix
./mastodon.nix
];
security.acme = {
acceptTerms = true;
defaults.email = root_email;
certs."${domain}" = {
webroot = "/var/lib/acme/acme-challenge/";
};
};
networking.firewall.allowedTCPPorts = [
80
443
];
services.nginx = {
# package = pkgs.nginxStable.override { openssl = pkgs.libressl; };
enable = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
sslCiphers = "AES256+EECDH:AES256+EDH:!aNULL";
virtualHosts."${domain}" = {
forceSSL = true;
enableACME = lib.mkForce false; # use the correct cert, not some weird one that matrix-synapse module supplies
useACMEHost = domain;
locations."/" = {
root = "/var/www/${domain}";
};
};
};
users.users.nginx.extraGroups = [ "acme" ];
}

View File

@ -1,22 +0,0 @@
{
lib,
config,
inputs,
pkgs,
...
}:
let
inherit (config.networking) domain;
root_email = "contact@${domain}";
in
{
security.acme = {
acceptTerms = true;
defaults.email = root_email;
certs."${domain}" = {
webroot = "/var/lib/acme/acme-challenge/";
};
};
users.users.nginx.extraGroups = [ "acme" ];
}

View File

@ -11,38 +11,15 @@ in
{ {
imports = [ ./hardware-configuration.nix ]; imports = [ ./hardware-configuration.nix ];
boot = { # boot = {
kernelPackages = pkgs.linuxPackages_latest; # kernelPackages = pkgs.linuxPackages_latest;
}; # };
networking.firewall.allowedTCPPorts = [
80
443
];
networking.hostName = "grimmauld-nixos-server"; networking.hostName = "grimmauld-nixos-server";
networking.domain = "grimmauld.de"; networking.domain = "grimmauld.de";
services.openssh.enable = true; services.openssh.enable = true;
system.stateVersion = "23.11"; system.stateVersion = "23.11";
# networking.networkmanager.enable = lib.mkForce false; networking.networkmanager.enable = lib.mkForce false;
services.nginx = {
# package = pkgs.nginxStable.override { openssl = pkgs.libressl; };
enable = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
sslCiphers = "AES256+EECDH:AES256+EDH:!aNULL";
virtualHosts."${domain}" = {
forceSSL = true;
enableACME = lib.mkForce false; # use the correct cert, not some weird one that matrix-synapse module supplies
useACMEHost = domain;
locations."/" = {
root = "/var/www/${domain}";
};
};
};
# users.users.root.openssh.authorizedKeys.keys = (import ./authorizedKeys.nix); # users.users.root.openssh.authorizedKeys.keys = (import ./authorizedKeys.nix);
} }