{ config, pkgs, ... }: let envsubstConfiguration = pkgs.callPackage /opt/secrets/envsubst-configuration.nix { }; config = rec { TLD = envsubstConfiguration.TLD; cgitPort = "81"; openSSHPort = 23841; }; in { imports = [ ./hardware-configuration.nix (builtins.fetchTarball { url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/master/nixos-mailserver-master.tar.gz"; }) ]; boot.loader.grub = { enable = true; version = 2; device = "/dev/vda"; }; networking = { interfaces.ens3.useDHCP = true; }; nix = { gc = { automatic = true; options = "--delete-older-than 7d"; }; # min-free 1G extraOptions = '' min-free = ${toString (1024 * 1024 * 1024)} ''; }; environment = { systemPackages = let c99 = pkgs.tinycc.overrideAttrs (oldAttrs: { postInstall = '' ln -s $out/bin/tcc $out/bin/c99 ''; }); in with pkgs; [ vim git gitAndTools.git-annex gnumake gnum4 c99 bpytop ]; shellAliases = { l = "ls -lahF"; }; }; networking.firewall.allowedTCPPorts = [ # SSH: OpenSSH config.openSSHPort # HTTP and HTPPS: NGINX 80 443 # Git daemon 9418 ]; security = { acme = { acceptTerms = true; email = "eu@euandre.org"; }; sudo.enable = false; doas = { enable = true; extraConfig = '' permit nopass setenv { NIX_PATH } :wheel ''; }; }; services = { openssh = { enable = true; permitRootLogin = "no"; passwordAuthentication = false; ports = [ config.openSSHPort ]; }; nginx = { enable = true; recommendedGzipSettings = true; recommendedOptimisation = true; recommendedProxySettings = true; recommendedTlsSettings = true; virtualHosts = { "${config.TLD}" = { forceSSL = true; enableACME = true; root = "/srv/http/"; extraConfig = '' # Allow