{ config, pkgs, ... }: let envsubstConfiguration = pkgs.callPackage /etc/nixos/envsubst-configuration.nix { }; config = rec { TLD = envsubstConfiguration.TLD; cgitPort = "81"; openSSHPort = 23841; }; in { imports = [ ./hardware-configuration.nix ]; boot.loader.grub = { enable = true; version = 2; device = "/dev/vda"; }; networking = { useDHCP = false; 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 ]; 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 = '' autoindex on; ''; }; "git.${config.TLD}" = { forceSSL = true; enableACME = true; extraConfig = '' location = /favicon.ico { alias ${pkgs.cgit}/cgit/favicon.ico; } location / { # Allow