2024-06-28 19:12:55 +01:00
|
|
|
{ config
|
|
|
|
, pkgs
|
|
|
|
, lib
|
|
|
|
, modulesPath
|
|
|
|
, flake-inputs
|
|
|
|
, ...
|
2022-10-10 13:03:08 +01:00
|
|
|
}: {
|
2021-04-19 00:39:33 +01:00
|
|
|
imports = [
|
2024-03-02 01:27:24 +00:00
|
|
|
flake-inputs.disko.nixosModules.disko
|
2023-02-26 05:44:54 +00:00
|
|
|
flake-inputs.sops-nix.nixosModules.sops
|
|
|
|
flake-inputs.tlaternet-webserver.nixosModules.default
|
|
|
|
|
2022-10-30 17:43:52 +00:00
|
|
|
"${modulesPath}/profiles/minimal.nix"
|
2022-10-13 00:03:32 +01:00
|
|
|
(import ../modules)
|
|
|
|
|
2024-04-15 01:58:09 +01:00
|
|
|
./services/afvalcalendar.nix
|
2023-09-22 05:20:36 +01:00
|
|
|
./services/backups.nix
|
2024-04-08 19:02:53 +01:00
|
|
|
./services/battery-manager.nix
|
2022-10-21 20:48:14 +01:00
|
|
|
./services/conduit.nix
|
2023-10-07 21:14:43 +01:00
|
|
|
./services/fail2ban.nix
|
2023-04-23 15:46:38 +01:00
|
|
|
./services/foundryvtt.nix
|
2021-04-19 00:39:33 +01:00
|
|
|
./services/gitea.nix
|
2023-10-07 21:14:43 +01:00
|
|
|
./services/metrics
|
2021-04-19 00:39:33 +01:00
|
|
|
./services/nextcloud.nix
|
|
|
|
./services/webserver.nix
|
2023-04-23 15:46:38 +01:00
|
|
|
./services/wireguard.nix
|
2022-04-23 04:08:45 +01:00
|
|
|
./services/starbound.nix
|
2022-10-12 18:04:06 +01:00
|
|
|
./services/postgres.nix
|
2024-03-12 04:44:47 +00:00
|
|
|
./nginx.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
|
|
|
|
2022-10-13 00:03:32 +01:00
|
|
|
nixpkgs.overlays = [
|
|
|
|
(final: prev: {
|
|
|
|
local = import ../pkgs {
|
|
|
|
pkgs = prev;
|
2022-10-17 11:00:02 +01:00
|
|
|
lib = prev.lib;
|
2022-10-13 00:03:32 +01:00
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-04-12 01:35:24 +01:00
|
|
|
nix = {
|
|
|
|
package = pkgs.nixFlakes;
|
|
|
|
extraOptions = ''
|
|
|
|
experimental-features = nix-command flakes
|
|
|
|
'';
|
2021-04-28 00:22:21 +01:00
|
|
|
|
|
|
|
# Enable remote builds from tlater
|
2024-06-28 19:12:55 +01:00
|
|
|
settings.trusted-users = [ "@wheel" ];
|
2021-04-12 01:35:24 +01:00
|
|
|
};
|
|
|
|
|
2022-04-23 04:08:45 +01:00
|
|
|
nixpkgs.config.allowUnfreePredicate = pkg:
|
2024-06-28 19:12:55 +01:00
|
|
|
builtins.elem (lib.getName pkg) [ "steam-original" "steam-runtime" "steam-run" "steamcmd" ];
|
2022-04-23 04:08:45 +01:00
|
|
|
|
2022-10-12 01:24:54 +01:00
|
|
|
# Optimization for minecraft servers, see:
|
|
|
|
# https://bugs.mojang.com/browse/MC-183518
|
2024-06-28 19:12:55 +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 = {
|
|
|
|
usePredictableInterfaceNames = false;
|
|
|
|
useDHCP = false;
|
|
|
|
|
2022-10-29 00:13:44 +01:00
|
|
|
firewall = {
|
|
|
|
allowedTCPPorts = [
|
|
|
|
# http
|
|
|
|
80
|
|
|
|
443
|
|
|
|
# ssh
|
|
|
|
2222
|
|
|
|
# matrix
|
|
|
|
8448
|
|
|
|
# starbound
|
|
|
|
21025
|
2023-01-11 02:00:13 +00:00
|
|
|
# Minecraft
|
|
|
|
25565
|
2022-10-29 00:13:44 +01:00
|
|
|
|
|
|
|
config.services.coturn.listening-port
|
|
|
|
config.services.coturn.tls-listening-port
|
2022-11-05 22:26:52 +00:00
|
|
|
config.services.coturn.alt-listening-port
|
|
|
|
config.services.coturn.alt-tls-listening-port
|
2022-10-29 00:13:44 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
allowedUDPPorts = [
|
2023-01-11 02:00:13 +00:00
|
|
|
# More minecraft
|
|
|
|
25565
|
|
|
|
|
2022-10-29 00:13:44 +01:00
|
|
|
config.services.coturn.listening-port
|
|
|
|
config.services.coturn.tls-listening-port
|
2022-11-05 22:26:52 +00:00
|
|
|
config.services.coturn.alt-listening-port
|
|
|
|
config.services.coturn.alt-tls-listening-port
|
2022-10-29 00:13:44 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
allowedUDPPortRanges = [
|
|
|
|
{
|
|
|
|
from = config.services.coturn.min-port;
|
|
|
|
to = config.services.coturn.max-port;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2021-04-12 01:35:24 +01:00
|
|
|
};
|
|
|
|
|
2023-04-23 15:46:38 +01:00
|
|
|
systemd.network.enable = true;
|
|
|
|
|
2021-04-12 01:35:24 +01:00
|
|
|
time.timeZone = "Europe/London";
|
|
|
|
|
|
|
|
users.users.tlater = {
|
|
|
|
isNormalUser = true;
|
2024-06-28 19:12:55 +01:00
|
|
|
extraGroups = [ "wheel" ];
|
|
|
|
openssh.authorizedKeys.keyFiles = [ ../keys/tlater.pub ];
|
2021-04-12 01:35:24 +01:00
|
|
|
};
|
|
|
|
|
2024-03-12 04:44:47 +00:00
|
|
|
services = {
|
|
|
|
openssh = {
|
|
|
|
enable = true;
|
|
|
|
allowSFTP = false;
|
2024-06-28 19:12:55 +01:00
|
|
|
ports = [ 2222 ];
|
2024-03-12 04:44:47 +00:00
|
|
|
startWhenNeeded = true;
|
|
|
|
|
|
|
|
settings = {
|
|
|
|
GatewayPorts = "yes";
|
|
|
|
PermitRootLogin = "no";
|
|
|
|
PasswordAuthentication = false;
|
|
|
|
};
|
2023-07-28 10:23:56 +01:00
|
|
|
};
|
2024-03-12 04:44:47 +00:00
|
|
|
|
|
|
|
logrotate.enable = true;
|
2021-04-12 01:35:24 +01:00
|
|
|
};
|
|
|
|
|
2022-11-05 17:59:27 +00:00
|
|
|
security = {
|
|
|
|
sudo.execWheelOnly = true;
|
|
|
|
|
|
|
|
pam = {
|
2024-06-13 23:49:12 +01:00
|
|
|
sshAgentAuth = {
|
|
|
|
enable = true;
|
2024-06-28 19:12:55 +01:00
|
|
|
authorizedKeysFiles = [ "/etc/ssh/authorized_keys.d/%u" ];
|
2024-06-13 23:49:12 +01:00
|
|
|
};
|
2022-11-05 17:59:27 +00:00
|
|
|
services.sudo.sshAgentAuth = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-10-30 17:43:52 +00:00
|
|
|
# Remove some unneeded packages
|
2024-06-28 19:12:55 +01:00
|
|
|
environment.defaultPackages = [ ];
|
2022-10-30 17:43:52 +00:00
|
|
|
|
2021-04-12 01:35:24 +01:00
|
|
|
system.stateVersion = "20.09";
|
|
|
|
}
|