infra/nix/oracle-nix-cache/configuration.nix

140 lines
3.2 KiB
Nix
Raw Normal View History

{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware.nix
];
2023-10-30 12:26:56 +00:00
boot = {
tmp.cleanOnBoot = true;
};
zramSwap.enable = true;
nix = {
settings = {
auto-optimise-store = true;
experimental-features = ["nix-command" "flakes"];
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
# Free up to 1GiB whenever there is less than 100MiB left.
extraOptions = ''
min-free = ${toString (100 * 1024 * 1024)}
max-free = ${toString (1024 * 1024 * 1024)}
'';
};
networking = {
hostName = "nix-cache";
domain = "gmem.ca";
firewall = {
trustedInterfaces = ["tailscale0"];
checkReversePath = "loose";
allowedTCPPorts = [ 80 443 ];
allowedUDPPortRanges = [
{ from = 4000; to = 4007; }
{ from = 8000; to = 8010; }
];
2023-08-06 00:04:21 +01:00
allowedUDPPorts = [ 41641 ];
enable = true;
};
nftables.enable = true;
nameservers = [ "1.1.1.1" "1.0.0.1" ];
};
time.timeZone = "Europe/London";
users.users.root.openssh.authorizedKeys.keys = let
authorizedKeys = pkgs.fetchurl {
url = "https://gmem.ca/ssh";
2023-09-05 17:10:55 +01:00
sha256 = "0vm0q5fzx55mmgw7md430c20rvywmknmpvnkffx9szlm0l74bypc";
};
in pkgs.lib.splitString "\n" (builtins.readFile
authorizedKeys);
environment.systemPackages = with pkgs; [
vim
wget
htop
git
screen
nix-output-monitor
tailscale
nfs-utils
];
services = {
rpcbind.enable = true;
openssh.enable = true;
tailscale.enable = true;
nginx = {
enable = true;
recommendedProxySettings = true;
recommendedGzipSettings = true;
recommendedBrotliSettings = true;
recommendedZstdSettings = true;
recommendedOptimisation = true;
recommendedTlsSettings = true;
virtualHosts = {
2023-09-05 17:10:55 +01:00
"git.gmem.ca" = {
enableACME = true;
forceSSL = true;
2023-09-05 17:10:55 +01:00
locations."/" = {
proxyPass = "http://100.116.48.47";
extraConfig =
''
client_max_body_size 100M;
'';
};
};
2023-09-05 17:10:55 +01:00
"food.gmem.ca" = {
enableACME = true;
forceSSL = true;
locations."/" = {
2023-09-05 17:10:55 +01:00
proxyPass = "http://100.77.43.133";
extraConfig =
''
client_max_body_size 100M;
'';
};
};
2023-10-30 12:26:56 +00:00
"authentik.gmem.ca" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyWebsockets = true;
proxyPass = "https://pi.gmem.ca";
recommendedProxySettings = true;
};
};
2023-12-09 22:42:14 +00:00
"photos.gmem.ca" = {
2023-10-30 12:26:56 +00:00
enableACME = true;
forceSSL = true;
locations."/" = {
proxyWebsockets = true;
proxyPass = "https://pi.gmem.ca";
recommendedProxySettings = true;
2023-12-09 22:42:14 +00:00
extraConfig = ''
client_max_body_size 50000M;
'';
2023-10-30 12:26:56 +00:00
};
};
};
};
};
security.acme = {
acceptTerms = true;
2023-09-05 17:10:55 +01:00
defaults = {
email = "acme@gmem.ca";
};
};
system.stateVersion = "23.11"; # dId YoU rEaD tHe CoMmEnT?
}