126 lines
3 KiB
Nix
126 lines
3 KiB
Nix
{ config, lib, pkgs, ... }:
|
||
|
||
{
|
||
imports =
|
||
[
|
||
./hardware-configuration.nix
|
||
];
|
||
|
||
security.pam.loginLimits = [{
|
||
domain = "*";
|
||
type = "soft";
|
||
item = "nofile";
|
||
value = "8192";
|
||
}];
|
||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||
nix.settings.download-buffer-size = 6710886400;
|
||
boot.loader.grub.enable = true;
|
||
boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
|
||
|
||
networking.hostName = "authentik";
|
||
networking.interfaces.ens18.ipv4.addresses = [
|
||
{
|
||
address = "141.56.51.18";
|
||
prefixLength = 24;
|
||
}
|
||
];
|
||
networking.defaultGateway.address = "141.56.51.254";
|
||
networking.nameservers = [ "141.56.1.1" "141.56.1.2" ];
|
||
|
||
time.timeZone = "Europe/Berlin";
|
||
|
||
i18n.defaultLocale = "en_US.UTF-8";
|
||
console = {
|
||
font = "Lat2-Terminus16";
|
||
keyMap = lib.mkForce "de";
|
||
useXkbConfig = true; # use xkb.options in tty.
|
||
};
|
||
|
||
users.groups.authentik = { };
|
||
users.users.authentik = {
|
||
isSystemUser = true;
|
||
extraGroups = [ "docker" ];
|
||
group = "authentik";
|
||
};
|
||
users.users.administration = {
|
||
isNormalUser = true;
|
||
extraGroups = [ "wheel" "docker" ]; # Enable ‘sudo’ for the user.
|
||
packages = with pkgs; [
|
||
];
|
||
};
|
||
|
||
environment.systemPackages = with pkgs; [
|
||
tmux
|
||
git
|
||
htop
|
||
neovim
|
||
];
|
||
|
||
services.openssh.enable = true;
|
||
services.authentik = {
|
||
enable = true;
|
||
# The environmentFile needs to be on the target host!
|
||
# Best use something like sops-nix or agenix to manage it
|
||
environmentFile = "/var/lib/authentik_secret";
|
||
settings = {
|
||
email = {
|
||
host = "mail.stura.htw-dresden.de";
|
||
port = 25;
|
||
username = "authentik@stura.htw-dresden.de";
|
||
use_tls = false;
|
||
use_ssl = false;
|
||
from = "authentik@stura.htw-dresden.de";
|
||
};
|
||
disable_startup_analytics = true;
|
||
avatars = "initials";
|
||
};
|
||
|
||
nginx = {
|
||
enable = true;
|
||
enableACME = true;
|
||
host = "auth.htw.stura-dresden.de";
|
||
};
|
||
};
|
||
services.dovecot2 = {
|
||
extraConfig = ''
|
||
auth_verbose = yes
|
||
auth_debug = yes
|
||
auth_debug_passwords = yes
|
||
'';
|
||
};
|
||
|
||
services.nginx.virtualHosts."auth.htw.stura-dresden.de".locations."/".extraConfig = ''
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
'';
|
||
mailserver = {
|
||
enable = true;
|
||
fqdn = "mail.htw.stura-dresden.de";
|
||
domains = [ "htw.stura-dresden.de" ];
|
||
ldap = {
|
||
enable = true;
|
||
bind = {
|
||
dn = "cn=dovecot,ou=users,dc=auth,dc=htw,dc=stura-dresden,dc=de";
|
||
passwordFile = "/var/lib/dovecot_ldap_passwd";
|
||
};
|
||
dovecot = { };
|
||
searchBase = "dc=auth,dc=htw,dc=stura-dresden,dc=de";
|
||
searchScope = "sub";
|
||
uris = [
|
||
"ldap://localhost:389"
|
||
];
|
||
};
|
||
|
||
certificateScheme = "acme-nginx";
|
||
};
|
||
|
||
virtualisation.docker.enable = true;
|
||
security.acme.acceptTerms = true;
|
||
security.acme.defaults.email = "cert@stura.htw-dresden.de";
|
||
|
||
networking.firewall.allowedTCPPorts = [ 80 443 389 9000 ];
|
||
|
||
system.stateVersion = "24.11";
|
||
|
||
}
|
||
|