nix-infra/hosts/bloodletting/configuration.nix

167 lines
4.3 KiB
Nix
Raw Normal View History

{ config, pkgs, ... }: {
imports = [
./hardware-configuration.nix
../../common/fragments/bin.nix
../../common/fragments/fail2ban.nix
../../common/fragments/grafana.nix
../../common/fragments/homepage.nix
../../common/fragments/mastodon-ebooks.nix
../../common/fragments/matterbridge.nix
2023-03-07 19:24:57 +00:00
../../common/fragments/minecraft.nix
../../common/fragments/nyandroid.nix
../../common/fragments/prometheus_exporters.nix
2023-03-06 19:43:10 +00:00
../../common/fragments/vsftpd.nix
../../common/home_manager/common.nix
];
nixpkgs.overlays = [
2023-03-06 19:43:10 +00:00
(self: super: {
bin = self.callPackage ../../common/pkgs/bin.nix { };
vampysite = self.callPackage ../../common/pkgs/vampysite.nix { };
})
];
# Bootloader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.useOSProber = true;
networking.hostName = "bloodletting";
# Enable networking
networking.networkmanager.enable = true;
2023-03-18 18:29:55 +00:00
networking.interfaces.ens19.ipv4.addresses = [{
address = "185.138.143.227";
prefixLength = 29;
}];
networking.defaultGateway = {
address = "185.138.143.225";
interface = "ens19";
};
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
banner = ''
Hello mistress ^,,^
'';
passwordAuthentication = false;
};
# Open ports in the firewall.
networking.firewall = {
2023-03-18 18:29:55 +00:00
allowedTCPPorts = [ 20 21 22 80 443 990 6162 ];
allowedTCPPortRanges = [{
from = 40000;
to = 40200;
}];
};
virtualisation = {
podman = {
enable = true;
dockerCompat = true;
defaultNetwork.dnsname.enable = true;
};
oci-containers = { backend = "podman"; };
};
# SSL/TLS Certificates
security.acme.acceptTerms = true;
security.acme.defaults.email = "letsencrypt@technogothic.net";
security.acme.certs."technogothic.net" = {
domain = "*.technogothic.net";
2023-03-18 18:29:55 +00:00
extraDomainNames = [ "technogothic.net" ];
dnsProvider = "rfc2136";
credentialsFile = "/var/lib/secrets/rfc2136-technogothic-net";
2023-03-06 19:43:10 +00:00
group = "nginx";
};
security.acme.defaults.reloadServices = [ "nginx" "vsftpd" ];
2023-03-18 18:29:55 +00:00
systemd.services.nginx.serviceConfig.ProtectHome = "read-only";
2023-03-06 19:43:10 +00:00
# Nginx
services.nginx = {
enable = true;
statusPage = true;
# Use recommended settings
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts."technogothic.net" = {
useACMEHost = "technogothic.net";
forceSSL = true;
root = pkgs.vampysite;
2023-03-18 18:29:55 +00:00
serverAliases = [ "agatha.technogothic.net" ];
2023-03-06 19:43:10 +00:00
locations."=/cv.pdf" = { alias = "/home/ftp/cv.pdf"; };
extraConfig = ''
error_page 404 /404.html;
'';
};
2023-03-18 18:29:55 +00:00
virtualHosts."www.technogothic.net" = {
useACMEHost = "technogothic.net";
forceSSL = true;
globalRedirect = "technogothic.net";
};
2023-03-06 19:43:10 +00:00
virtualHosts."grafana.technogothic.net" = {
useACMEHost = "technogothic.net";
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:2342";
proxyWebsockets = true;
};
};
virtualHosts."home.technogothic.net" = {
useACMEHost = "technogothic.net";
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:3000";
proxyWebsockets = true;
};
};
virtualHosts."thermalpaste.technogothic.net" = {
useACMEHost = "technogothic.net";
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:6162";
proxyWebsockets = true;
};
};
2023-03-18 18:29:55 +00:00
virtualHosts."ftp.technogothic.net" = {
useACMEHost = "technogothic.net";
forceSSL = true;
root = "/home/ftp";
locations."/" = { extraConfig = "autoindex on;"; };
};
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.11"; # Did you read the comment?
}