Add of vaulwarden

Some refractoring and start of a more versatil config
This commit is contained in:
Wateir 2025-12-17 23:11:49 +01:00
parent 372b6bc4bb
commit d4d7073344
6 changed files with 96 additions and 33 deletions

13
module/acme.nix Normal file
View file

@ -0,0 +1,13 @@
{ config, ... }:
{
security.acme = {
acceptTerms = true;
defaults.email = "admin+contact@wateir.fr";
certs."wateir.fr" = {
dnsProvider = "ovh";
environmentFile = "/etc/acme.env";
};
};
}

11
module/hostname.nix Normal file
View file

@ -0,0 +1,11 @@
{ 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";
};
}

View file

@ -1,12 +1,14 @@
{ config, ... }:
{ config,pkgs,lib, ... }:
{
lib.mkIf (config.networking.hostName == "ThinkCentre-Server-004") {
services.roundcube = {
enable = true;
hostName = "_";
hostName = "${config.HostName}";
plugins = [ "multiple_accounts" ];
configureNginx = false;
extraConfig = ''
# PurelyMail is the entreprise who host my mail
$config['default_host'] = 'ssl://imap.purelymail.com';
@ -19,14 +21,10 @@
};
services.nginx = {
enable = true;
virtualHosts."_" = {
virtualHosts."${config.HostName}" = {
listen = [
{ addr = "0.0.0.0"; port = 1984; }
];
forceSSL = false;
enableACME = false;
};
};

View file

@ -1,11 +1,11 @@
{ config,lib,pkgs, ... }:
{
services = {
searx = {
lib.mkIf (config.networking.hostName == "ThinkCentre-Server-004"){
services.searx = {
enable = true;
redisCreateLocally = true;
package = pkgs.searxng;
environmentFile = "/etc/searx.env";
settings.server = {
bind_address = "0.0.0.0";
@ -14,6 +14,8 @@
# see below for the sops or environment file instructions to prevent this
# secret_key = "$SEARXNG_SECRET";
};
settings.engines = lib.mapAttrsToList (name: value: { inherit name; } // value) {
"wikidata".disabled = true;
};
};
};
}

View file

@ -0,0 +1,35 @@
{ config, pkgs, lib, ... }:
lib.mkIf (config.networking.hostName == "ThinkCentre-Server-004"){
services.vaultwarden = {
enable = true;
backupDir = "/var/local/vaultwarden/backup";
config = {
SIGNUPS_ALLOWED = true;
ROCKET_PORT = 8222;
};
};
services.nginx = {
enable = true;
virtualHosts = {
"${config.HostName}" = {
listen = [{ addr = "0.0.0.0"; port = 8000; }];
locations."/" = {
proxyPass = "http://127.0.0.1:8222";
extraConfig = ''
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
'';
};
};
};
};
networking.firewall.allowedTCPPorts = [ 8000 ];
}