dotfiles/provision/hosts/torus/configuration.nix

113 lines
2.9 KiB
Nix
Raw Normal View History

2024-12-21 14:31:57 -08:00
{ config, pkgs, user, lib, hostname, ... }:
2023-07-23 14:38:24 -07:00
{
imports = [
./wireguard-server.nix
2023-10-07 02:11:46 -07:00
./samba-server.nix
./rss.nix
./home-assistant
2024-01-01 00:13:30 -08:00
./gitea.nix
2024-05-21 21:53:08 -07:00
./nextcloud.nix
./backup.nix
2024-09-30 10:43:24 -07:00
./jellyfin.nix
];
2023-07-23 14:59:13 -07:00
# Use normal kernel
boot.kernelPackages = pkgs.linuxPackages;
2023-07-23 14:38:24 -07:00
2023-07-25 15:23:07 -07:00
# Set kernel modules
boot.kernelModules = [ "sg" ];
2023-07-23 14:38:24 -07:00
# Set networking options
2024-12-21 14:31:57 -08:00
networking.hostName = "${hostname}";
2023-10-07 02:00:29 -07:00
networking.firewall.enable = true;
2023-07-23 14:38:24 -07:00
networking.firewall.checkReversePath = "loose";
2023-10-07 02:00:29 -07:00
networking.firewall.allowedTCPPorts = [ 80 443 ];
networking.firewall.allowedUDPPorts = [ 80 443 ];
boot.kernel.sysctl = {
"net.ipv4.conf.all.forwarding" = true; # Needed for wireguard-server
};
2023-07-23 14:38:24 -07:00
# Enable virtualisation
2024-08-15 21:29:02 -07:00
virtualisation.docker = {
enable = true;
package = pkgs.docker_27;
storageDriver = "btrfs";
};
2024-09-13 19:14:21 -07:00
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia.open = false;
2023-07-25 15:23:07 -07:00
2023-09-02 17:47:18 -07:00
security.acme = {
acceptTerms = true;
defaults.email = "starrtyler88@gmail.com";
};
# Nginx
2023-09-12 22:20:31 -07:00
security.pam.services.nginx.setEnvironment = false;
systemd.services.nginx.serviceConfig = { SupplementaryGroups = [ "shadow" ]; };
2023-09-02 17:47:18 -07:00
services.nginx = {
enable = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
2023-09-12 22:20:31 -07:00
additionalModules = [ pkgs.nginxModules.pam ];
virtualHosts = let
SSL = {
enableACME = true;
forceSSL = true;
}; in {
2023-11-05 00:43:29 -07:00
"rss.tstarr.us" = (SSL // {
2023-12-03 11:59:59 -08:00
locations."/".proxyPass = "http://localhost:8087/";
});
2023-09-12 22:20:31 -07:00
"media.tstarr.us" = (SSL // {
locations."/".proxyPass = "http://localhost:8096/";
});
2024-01-01 00:13:30 -08:00
"git.tstarr.us" = (SSL // {
locations."/".proxyPass = "http://localhost:3001/";
2024-10-14 15:57:19 -07:00
extraConfig = ''
client_max_body_size 3000m;
'';
2024-01-01 00:13:30 -08:00
});
2024-05-04 16:17:59 -07:00
"workspace.tstarr.us" = (SSL // {
locations."/".proxyPass = "http://localhost:5000/";
});
2024-07-17 22:21:35 -07:00
"lc.tstarr.us" = (SSL // {
locations."/" = {
proxyPass = "http://localhost:8065/";
proxyWebsockets = true;
};
});
2024-05-04 16:17:59 -07:00
"code.tstarr.us" = (SSL // {
locations."/" = {
proxyPass = "http://localhost:8443/";
proxyWebsockets = true;
};
});
"plot.tstarr.us" = (SSL // {
locations."/".proxyPass = "http://localhost:8988/";
});
2023-09-12 22:20:31 -07:00
};
2023-09-02 17:47:18 -07:00
};
# Modules
2023-07-23 14:38:24 -07:00
modules = {
programs = {
2024-09-30 10:35:46 -07:00
chezmoi.apply = true;
2024-10-27 10:05:17 -07:00
borg.enable = true;
};
2024-10-27 10:05:17 -07:00
services = {
2023-09-12 22:18:09 -07:00
ssh.enable = true;
2024-11-01 22:07:00 -07:00
syncthing = {
enable = true;
keyPath = ../../secrets/syncthing/torus/key.pem.age;
certPath = ../../secrets/syncthing/torus/cert.pem.age;
devices = {
"bulwark" = { id = "YKPOWTQ-XMXG3SD-XKLPVEC-H4SO345-2ZZQK65-EBISRED-ISKCFMQ-T74P6Q5"; };
"kestrel" = { id = "5WWL4FE-ARZ4FHP-J33HQCH-CZKEXLN-2RAY4KW-PDI754F-3HVPZYI-VC3ESAF"; };
};
};
2023-07-23 17:10:08 -07:00
};
2023-07-23 14:38:24 -07:00
};
}