nixos-configuration/hosts/hetzner-vpn1/environment.nix

82 lines
2.8 KiB
Nix
Raw Normal View History

2024-03-02 13:46:13 +01:00
{
pkgs,
lib,
...
2024-10-26 16:43:08 +02:00
}: {
2023-09-10 14:12:01 +02:00
imports = [
2024-10-26 14:59:00 +02:00
../../users/vinzenz.nix
../../users/ronja.nix
2023-09-10 14:12:01 +02:00
];
config = {
2024-05-02 15:49:00 +02:00
users.users = {
root.openssh.authorizedKeys.keys = [
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICdYqY3Y1/f1bsAi5Qfyr/UWuX9ixu96IeAlhoQaJkbf''
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFCJUpbpB3KEKVoKWsKoar9J4RNah8gmQoSH6jQEw5dY vinzenz-pixel-JuiceSSH''
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO1CRn4yYTL4XUdCebE8Z4ZeuMujBjorTdWifg911EOv vinzenz-pc2 home roaming''
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPDNpLDmctyqGpow/ElQvdhY4BLBPS/sigDJ1QEcC7wC vinzenz-lpt2-roaming''
];
vinzenz.openssh.authorizedKeys.keys = [
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICdYqY3Y1/f1bsAi5Qfyr/UWuX9ixu96IeAlhoQaJkbf''
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFCJUpbpB3KEKVoKWsKoar9J4RNah8gmQoSH6jQEw5dY vinzenz-pixel-JuiceSSH''
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO1CRn4yYTL4XUdCebE8Z4ZeuMujBjorTdWifg911EOv vinzenz-pc2 home roaming''
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPDNpLDmctyqGpow/ElQvdhY4BLBPS/sigDJ1QEcC7wC vinzenz-lpt2-roaming''
];
ronja.openssh.authorizedKeys.keys = [
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIALWKm+d6KL6Vl3grPOcGouiNTkvdhXuWJmcrdEBY2nw ronja-ssh-host-key''
];
};
security.acme = {
acceptTerms = true;
defaults.email = "acme@zerforschen.plus";
};
2024-03-02 13:18:05 +01:00
security.pam.services.nginx.setEnvironment = false;
systemd.services.nginx.serviceConfig = {
SupplementaryGroups = ["shadow"];
};
services.nginx = {
enable = true;
2024-03-02 13:18:05 +01:00
additionalModules = [pkgs.nginxModules.pam];
recommendedProxySettings = true;
recommendedTlsSettings = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
2024-10-26 16:43:08 +02:00
virtualHosts = let
servicesDomain = "services.zerforschen.plus";
mkServiceConfig = host: port: {
addSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://${host}:${toString port}/";
extraConfig = ''
# bind to tailscale ip
proxy_bind 100.88.118.60;
# pam auth
limit_except OPTIONS {
auth_pam "Password Required";
auth_pam_service_name "nginx";
}
'';
};
};
lpt2 = "vinzenz-lpt2.donkey-pentatonic.ts.net";
pc2 = "vinzenz-pc2.donkey-pentatonic.ts.net";
in {
2024-03-02 13:46:13 +01:00
"vscode.${servicesDomain}" = lib.mkMerge [
2024-03-09 13:43:27 +01:00
(mkServiceConfig pc2 8542)
2024-03-02 13:46:13 +01:00
{locations."/" .proxyWebsockets = true;}
];
2024-03-09 13:43:27 +01:00
"preon-app.${servicesDomain}" = mkServiceConfig pc2 8543;
2024-03-09 14:08:14 +01:00
"preon-api.${servicesDomain}" = mkServiceConfig pc2 8544;
};
};
2024-03-02 13:02:14 +01:00
networking.firewall.allowedTCPPorts = [80 443];
2023-09-10 14:12:01 +02:00
};
}