nix formating, sops secrets migration, vps-init auto update
This commit is contained in:
parent
db022df80b
commit
fcee389f8e
17 changed files with 950 additions and 818 deletions
|
|
@ -1,71 +1,98 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
{ config, pkgs, ... }: {
|
||||
boot.kernelParams = [ "consoleblank=60" ];
|
||||
imports = [ ../common.nix ./hardware.nix ./mods/web.nix ./mods/mail.nix ./mods/system.nix ];
|
||||
imports = [
|
||||
../common.nix
|
||||
./hardware.nix
|
||||
./mods/mail.nix
|
||||
./mods/system.nix
|
||||
./mods/web.nix
|
||||
];
|
||||
networking = {
|
||||
firewall = {
|
||||
allowedTCPPorts = [
|
||||
25
|
||||
443
|
||||
465
|
||||
80
|
||||
993
|
||||
];
|
||||
allowedUDPPorts = [ 443 ];
|
||||
};
|
||||
hostName = "nixos-server";
|
||||
networkmanager.ensureProfiles.profiles.home-wifi = {
|
||||
ipv4.addresses = "10.1.0.2/16";
|
||||
ipv6.addresses = "fc01::2/64";
|
||||
wifi-security.psk = "$BOGALE_2_4_PSK";
|
||||
wifi.ssid = "bogale_2.4";
|
||||
};
|
||||
wg-quick.interfaces.awg0 = {
|
||||
address = [
|
||||
"10.0.0.2/32"
|
||||
"fc00::2/128"
|
||||
];
|
||||
configFile = config.sops.templates.awg1-conf.path;
|
||||
};
|
||||
};
|
||||
security.acme = {
|
||||
acceptTerms = true;
|
||||
certs."bogaledev.ru" = {
|
||||
credentialFiles.CF_DNS_API_TOKEN_FILE = config.sops.secrets.cf-token.path;
|
||||
dnsProvider = "cloudflare";
|
||||
extraDomainNames = [ "*.bogaledev.ru" ];
|
||||
reloadServices = [
|
||||
"dovecot.service"
|
||||
"nginx.service"
|
||||
"postfix.service"
|
||||
];
|
||||
validMinDays = 3;
|
||||
};
|
||||
defaults.email = "letsencrypt@bogaledev.ru";
|
||||
};
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings.PasswordAuthentication = false;
|
||||
};
|
||||
sops = {
|
||||
secrets.awg1-spec = {};
|
||||
secrets = {
|
||||
awg1-spec = { };
|
||||
cf-token = { };
|
||||
};
|
||||
templates.awg1-conf.content = ''
|
||||
${config.sops.placeholder.awg-obf}
|
||||
${config.sops.placeholder.awg1-spec}
|
||||
'';
|
||||
};
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /root/backup/server"
|
||||
"L /root/backup/server/http - - - - /srv/http"
|
||||
"L /root/backup/server/acme - - - - /var/lib/acme"
|
||||
"L /root/backup/server/mail - - - - /var/spool/mail"
|
||||
"L /root/backup/server/forgejo - - - - /var/lib/forgejo"
|
||||
"L /root/backup/server/http - - - - /srv/http"
|
||||
"L /root/backup/server/mail - - - - /var/spool/mail"
|
||||
"L /root/backup/server/postgresql - - - - /var/backup/postgresql"
|
||||
"d /root/backup/server"
|
||||
];
|
||||
security.acme = {
|
||||
acceptTerms = true;
|
||||
defaults.email = "letsencrypt@bogaledev.ru";
|
||||
certs."bogaledev.ru" = {
|
||||
validMinDays = 3;
|
||||
dnsProvider = "cloudflare";
|
||||
extraDomainNames = [ "*.bogaledev.ru" ];
|
||||
credentialFiles = { "CF_DNS_API_TOKEN_FILE" = "/secrets/cf-token"; };
|
||||
reloadServices = [ "nginx.service" "dovecot.service" "postfix.service" ];
|
||||
};
|
||||
};
|
||||
networking = {
|
||||
hostName = "nixos-server";
|
||||
firewall = {
|
||||
allowedUDPPorts = [ 443 ];
|
||||
allowedTCPPorts = [ 25 80 443 465 993 ];
|
||||
};
|
||||
wg-quick.interfaces.awg0 = {
|
||||
address = [ "10.0.0.2/32" "fc00::2/128" ];
|
||||
configFile = config.sops.templates.awg1-conf.path;
|
||||
};
|
||||
networkmanager.ensureProfiles.profiles.home-wifi = {
|
||||
wifi.ssid = "bogale_2.4";
|
||||
ipv6.addresses = "fc01::2/64";
|
||||
ipv4.addresses = "10.1.0.2/16";
|
||||
wifi-security.psk = "$BOGALE_2_4_PSK";
|
||||
};
|
||||
};
|
||||
users = {
|
||||
groups = {
|
||||
php.gid = 1568;
|
||||
vmail.gid = 1819;
|
||||
};
|
||||
users = {
|
||||
nginx.extraGroups = [ "php" "acme" "grafana" ];
|
||||
root.openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPTb4c1ISQSV34GN27GgaJ08jpiRM3Wul/iSWjQ6emTq" ];
|
||||
nginx.extraGroups = [
|
||||
"acme"
|
||||
"grafana"
|
||||
"php"
|
||||
];
|
||||
php = {
|
||||
uid = 1568;
|
||||
group = "php";
|
||||
isSystemUser = true;
|
||||
uid = 1568;
|
||||
};
|
||||
root.openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPTb4c1ISQSV34GN27GgaJ08jpiRM3Wul/iSWjQ6emTq"
|
||||
];
|
||||
vmail = {
|
||||
uid = 1819;
|
||||
group = "vmail";
|
||||
isSystemUser = true;
|
||||
uid = 1819;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue