feat : Add modular service to hostname
This commit is contained in:
parent
9453773af6
commit
1637885001
11 changed files with 112 additions and 66 deletions
|
|
@ -1,11 +1,11 @@
|
|||
{ config, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
lib.mkIf config.sACME.enable {
|
||||
security.acme = {
|
||||
acceptTerms = true;
|
||||
defaults.email = "admin+contact@wateir.fr";
|
||||
defaults.email = config.sACME.email;
|
||||
|
||||
certs."wateir.fr" = {
|
||||
certs."${config.sACME.domain}" = {
|
||||
dnsProvider = "ovh";
|
||||
environmentFile = "/etc/acme.env";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options.HostName = mkOption {
|
||||
type = types.str;
|
||||
default = "${config.networking.hostName}.ssh.wateir.fr";
|
||||
description = "Global hostname with domain for all services";
|
||||
};
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{config,lib, ... }:
|
||||
|
||||
{
|
||||
lib.mkIf config.sNEWT.enable{
|
||||
services.newt = {
|
||||
enable = true;
|
||||
environmentFile = "/etc/newt.env";
|
||||
|
|
|
|||
|
|
@ -1,17 +1,16 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
lib.mkIf (config.networking.hostName == "ThinkCentre-Server-004") {
|
||||
with lib;
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts = {
|
||||
{
|
||||
services.nginx.enable = true;
|
||||
|
||||
services.nginx.virtualHosts = mkMerge [
|
||||
(mkIf config.sVAULTWARDEN.enable {
|
||||
"${config.HostName}-vault" = {
|
||||
listen = [
|
||||
{ addr = "0.0.0.0"; port = 8000; }
|
||||
];
|
||||
|
||||
listen = [{ addr = "0.0.0.0"; port = config.sVAULTWARDEN.externalPort; }];
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:8222";
|
||||
proxyPass = "http://127.0.0.1:${toString config.sVAULTWARDEN.internalPort}";
|
||||
extraConfig = ''
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
|
@ -20,21 +19,18 @@ lib.mkIf (config.networking.hostName == "ThinkCentre-Server-004") {
|
|||
'';
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf config.sROUNDCUBE.enable {
|
||||
"${config.HostName}-roundcube" = {
|
||||
listen = [
|
||||
{ addr = "0.0.0.0"; port = 1984; }
|
||||
];
|
||||
|
||||
listen = [{ addr = "0.0.0.0"; port = config.sROUNDCUBE.port; }];
|
||||
root = "${pkgs.roundcube}/public_html";
|
||||
|
||||
locations."/" = {
|
||||
extraConfig = ''
|
||||
index index.php index.html;
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
'';
|
||||
};
|
||||
|
||||
locations."~ \\.php$" = {
|
||||
extraConfig = ''
|
||||
include ${pkgs.nginx}/conf/fastcgi_params;
|
||||
|
|
@ -43,9 +39,11 @@ lib.mkIf (config.networking.hostName == "ThinkCentre-Server-004") {
|
|||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 1984 8000 ];
|
||||
networking.firewall.allowedTCPPorts = concatLists [
|
||||
(if config.sVAULTWARDEN.enable then [ config.sVAULTWARDEN.externalPort ] else [])
|
||||
(if config.sROUNDCUBE.enable then [ config.sROUNDCUBE.port ] else [])
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
{ config,pkgs,lib, ... }:
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
lib.mkIf (config.networking.hostName == "ThinkCentre-Server-004") {
|
||||
lib.mkIf config.sROUNDCUBE.enable {
|
||||
services.roundcube = {
|
||||
enable = true;
|
||||
hostName = "${config.HostName}";
|
||||
|
||||
plugins = [ "multiple_accounts" ];
|
||||
|
||||
configureNginx = false;
|
||||
|
||||
extraConfig = ''
|
||||
# PurelyMail is the entreprise who host my mail
|
||||
# PurelyMail configuration
|
||||
$config['default_host'] = 'ssl://imap.purelymail.com';
|
||||
$config['default_port'] = 993;
|
||||
$config['smtp_server'] = 'tls://smtp.purelymail.com';
|
||||
|
|
@ -22,5 +21,4 @@ lib.mkIf (config.networking.hostName == "ThinkCentre-Server-004") {
|
|||
|
||||
systemd.services.nginx.serviceConfig.ProtectHome = false;
|
||||
users.groups.roundcube.members = [ "nginx" ];
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{ config,lib,pkgs, ... }:
|
||||
|
||||
lib.mkIf (config.networking.hostName == "ThinkCentre-Server-004"){
|
||||
lib.mkIf config.sSEARXNG.enable {
|
||||
services.searx = {
|
||||
enable = true;
|
||||
redisCreateLocally = true;
|
||||
|
|
@ -9,7 +9,7 @@ lib.mkIf (config.networking.hostName == "ThinkCentre-Server-004"){
|
|||
environmentFile = "/etc/searx.env";
|
||||
settings.server = {
|
||||
bind_address = "0.0.0.0";
|
||||
port = 1692;
|
||||
port = config.sSEARXNG.port;
|
||||
};
|
||||
settings.engines = lib.mapAttrsToList (name: value: { inherit name; } // value) {
|
||||
"wikidata".disabled = true;
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
{config,lib, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
lib.mkIf config.sTAILSCALE.enable {
|
||||
services.tailscale = {
|
||||
enable = true;
|
||||
extraDaemonFlags = [
|
||||
"--no-logs-no-support"
|
||||
];
|
||||
enable = true;
|
||||
extraDaemonFlags = [
|
||||
"--no-logs-no-support"
|
||||
];
|
||||
|
||||
extraSetFlags = [
|
||||
"--ssh=false"
|
||||
];
|
||||
useRoutingFeatures = "server"; # or "client" / "both"
|
||||
};
|
||||
extraSetFlags = [
|
||||
"--ssh=false"
|
||||
];
|
||||
useRoutingFeatures = "server";
|
||||
};
|
||||
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [ 443 ];
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
lib.mkIf (config.networking.hostName == "ThinkCentre-Server-004"){
|
||||
lib.mkIf config.sVAULTWARDEN.enable {
|
||||
services.vaultwarden = {
|
||||
enable = true;
|
||||
|
||||
backupDir = "/var/local/vaultwarden/backup";
|
||||
|
||||
environmentFile = "/etc/vaultwarden.env";
|
||||
|
||||
config = {
|
||||
ROCKET_PORT = config.sVAULTWARDEN.internalPort;
|
||||
ROCKET_ADDRESS = "127.0.0.1";
|
||||
SIGNUPS_ALLOWED = true;
|
||||
ROCKET_PORT = 8222;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue