2021-04-12 01:35:24 +01:00
|
|
|
{
|
2022-10-10 13:03:08 +01:00
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: {
|
2021-04-19 00:39:33 +01:00
|
|
|
imports = [
|
|
|
|
./services/gitea.nix
|
|
|
|
./services/nextcloud.nix
|
|
|
|
./services/webserver.nix
|
2022-04-23 04:08:45 +01:00
|
|
|
./services/starbound.nix
|
2021-04-19 00:39:33 +01:00
|
|
|
./ids.nix
|
2022-10-12 02:03:22 +01:00
|
|
|
./sops.nix
|
2021-04-19 00:39:33 +01:00
|
|
|
];
|
2021-04-12 01:35:24 +01:00
|
|
|
|
|
|
|
nix = {
|
2021-04-28 00:22:21 +01:00
|
|
|
# Enable flakes
|
2021-04-12 01:35:24 +01:00
|
|
|
package = pkgs.nixFlakes;
|
|
|
|
extraOptions = ''
|
|
|
|
experimental-features = nix-command flakes
|
|
|
|
'';
|
2021-04-28 00:22:21 +01:00
|
|
|
|
|
|
|
# Enable remote builds from tlater
|
2022-10-10 13:03:08 +01:00
|
|
|
trustedUsers = ["@wheel"];
|
2021-04-12 01:35:24 +01:00
|
|
|
};
|
|
|
|
|
2022-04-23 04:08:45 +01:00
|
|
|
nixpkgs.config.allowUnfreePredicate = pkg:
|
2022-10-12 01:05:24 +01:00
|
|
|
builtins.elem (lib.getName pkg) ["steam-runtime" "steamcmd"];
|
2022-04-23 04:08:45 +01:00
|
|
|
|
2022-10-10 13:03:08 +01:00
|
|
|
boot.kernelParams = ["highres=off" "nohz=off"];
|
2021-08-25 19:45:15 +01:00
|
|
|
|
2021-04-12 01:35:24 +01:00
|
|
|
networking = {
|
|
|
|
hostName = "tlaternet";
|
|
|
|
|
|
|
|
usePredictableInterfaceNames = false;
|
|
|
|
useDHCP = false;
|
|
|
|
interfaces.eth0.useDHCP = true;
|
|
|
|
|
2022-10-12 01:05:24 +01:00
|
|
|
firewall.allowedTCPPorts = [80 443 2222 2221 21025];
|
2021-04-12 01:35:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
time.timeZone = "Europe/London";
|
|
|
|
|
|
|
|
users.users.tlater = {
|
|
|
|
isNormalUser = true;
|
2022-10-10 13:03:08 +01:00
|
|
|
extraGroups = ["wheel"];
|
|
|
|
openssh.authorizedKeys.keyFiles = [../keys/tlater.pub];
|
2021-04-12 01:35:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
|
|
|
allowSFTP = false;
|
|
|
|
passwordAuthentication = false;
|
|
|
|
permitRootLogin = "no";
|
2022-10-10 13:03:08 +01:00
|
|
|
ports = [2222];
|
2021-04-12 01:35:24 +01:00
|
|
|
startWhenNeeded = true;
|
2022-10-10 13:01:26 +01:00
|
|
|
gatewayPorts = "yes";
|
2021-04-12 01:35:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
recommendedTlsSettings = true;
|
|
|
|
recommendedOptimisation = true;
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
clientMaxBodySize = "10G";
|
2021-05-17 00:00:34 +01:00
|
|
|
domain = "tlater.net";
|
2021-04-12 01:41:31 +01:00
|
|
|
|
|
|
|
virtualHosts = let
|
2022-10-12 01:24:54 +01:00
|
|
|
proxyPassToPort = port: extra:
|
2021-05-17 00:02:03 +01:00
|
|
|
lib.recursiveUpdate {
|
2021-04-12 01:41:31 +01:00
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
2021-10-12 13:53:08 +01:00
|
|
|
locations."/".proxyPass = "http://127.0.0.1:${toString port}";
|
|
|
|
extraConfig = ''
|
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
|
|
'';
|
2022-10-10 13:03:08 +01:00
|
|
|
}
|
|
|
|
extra;
|
2021-05-17 00:00:34 +01:00
|
|
|
domain = config.services.nginx.domain;
|
2021-04-12 01:42:46 +01:00
|
|
|
in {
|
2022-10-12 01:24:54 +01:00
|
|
|
"${domain}" = proxyPassToPort 3002 {serverAliases = ["www.${domain}"];};
|
|
|
|
"gitea.${domain}" = proxyPassToPort 3000 {};
|
|
|
|
"nextcloud.${domain}" = proxyPassToPort 3001 {};
|
2021-04-12 01:42:46 +01:00
|
|
|
};
|
2021-04-12 01:35:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
security.acme = {
|
|
|
|
email = "tm@tlater.net";
|
|
|
|
acceptTerms = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
virtualisation.oci-containers.backend = "podman";
|
|
|
|
|
|
|
|
system.stateVersion = "20.09";
|
|
|
|
}
|