2024-12-20 13:11:42 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
modulesPath,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: {
|
2024-10-23 21:03:11 +00:00
|
|
|
system.stateVersion = "24.11";
|
2024-10-24 09:31:32 +00:00
|
|
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
2024-12-20 13:11:42 +00:00
|
|
|
imports = [(modulesPath + "/profiles/qemu-guest.nix")];
|
2024-10-24 09:31:32 +00:00
|
|
|
|
|
|
|
boot = {
|
|
|
|
initrd.availableKernelModules = [
|
|
|
|
"ata_piix"
|
|
|
|
"uhci_hcd"
|
|
|
|
"virtio_pci"
|
|
|
|
"virtio_scsi"
|
|
|
|
"ahci"
|
|
|
|
"sd_mod"
|
|
|
|
"sr_mod"
|
|
|
|
"virtio_blk"
|
|
|
|
];
|
2024-12-20 13:11:42 +00:00
|
|
|
initrd.kernelModules = [];
|
2024-12-01 11:25:15 +00:00
|
|
|
kernelPackages = pkgs.linuxPackages_6_12;
|
2024-12-20 13:11:42 +00:00
|
|
|
kernelModules = ["kvm-amd"];
|
2024-12-05 14:21:51 +00:00
|
|
|
kernel = {
|
|
|
|
sysctl = {
|
|
|
|
"vm.max_map_count" = 2147483642;
|
2024-12-15 00:32:17 +00:00
|
|
|
"vm.swappiness" = 200;
|
|
|
|
"vm.watermark_boost_factor" = 0;
|
|
|
|
"vm.watermark_scale_factor" = 125;
|
|
|
|
"vm.page-cluster" = 0;
|
2024-12-05 14:21:51 +00:00
|
|
|
"net.ipv4.ip_forward" = 1;
|
|
|
|
"net.ipv6.conf.all.forwarding" = 1;
|
|
|
|
};
|
|
|
|
};
|
2024-12-20 13:11:42 +00:00
|
|
|
extraModulePackages = [];
|
2024-10-24 09:31:32 +00:00
|
|
|
loader.grub = {
|
|
|
|
enable = true;
|
|
|
|
device = "/dev/vda";
|
|
|
|
};
|
|
|
|
};
|
2024-10-23 21:03:11 +00:00
|
|
|
|
2024-11-03 19:31:25 +00:00
|
|
|
nix = {
|
|
|
|
package = pkgs.lix;
|
2024-11-07 22:17:24 +00:00
|
|
|
settings = {
|
2024-12-20 13:11:42 +00:00
|
|
|
experimental-features = ["nix-command" "flakes"];
|
2024-11-07 22:17:24 +00:00
|
|
|
auto-optimise-store = true;
|
|
|
|
sandbox = true;
|
|
|
|
};
|
2024-11-03 19:31:25 +00:00
|
|
|
};
|
|
|
|
|
2024-10-24 09:31:32 +00:00
|
|
|
zramSwap = {
|
2024-10-23 21:03:11 +00:00
|
|
|
enable = true;
|
2024-10-24 09:31:32 +00:00
|
|
|
algorithm = "zstd";
|
|
|
|
memoryPercent = 50;
|
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems."/" = {
|
|
|
|
device = "/dev/disk/by-uuid/09e65ff9-2195-41d8-b6a4-671c306742c3";
|
|
|
|
fsType = "ext4";
|
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems."/boot" = {
|
|
|
|
device = "/dev/disk/by-uuid/FED3-A372";
|
|
|
|
fsType = "vfat";
|
2024-12-20 13:11:42 +00:00
|
|
|
options = ["fmask=0022" "dmask=0022"];
|
2024-10-23 21:03:11 +00:00
|
|
|
};
|
|
|
|
|
2024-12-20 13:11:42 +00:00
|
|
|
swapDevices = [
|
|
|
|
{
|
|
|
|
device = "/var/lib/swapfile";
|
|
|
|
size = 16 * 1024;
|
|
|
|
}
|
|
|
|
];
|
2024-12-15 00:32:17 +00:00
|
|
|
|
2024-10-23 21:03:11 +00:00
|
|
|
networking = {
|
2024-10-25 06:29:48 +00:00
|
|
|
enableIPv6 = false; # Had to disable for now due to problems with resolving
|
2024-10-28 11:28:08 +00:00
|
|
|
firewall = {
|
|
|
|
allowedTCPPorts = [
|
|
|
|
80 # HTTP
|
|
|
|
443 # HTTPS
|
|
|
|
222 # git over ssh
|
2024-11-18 11:32:02 +00:00
|
|
|
25565 # minecraft
|
2024-12-14 16:55:47 +00:00
|
|
|
25566 # minecraft
|
2024-10-28 11:28:08 +00:00
|
|
|
];
|
|
|
|
allowedUDPPorts = [
|
|
|
|
25565 # minecraft
|
2024-12-14 16:55:47 +00:00
|
|
|
25566 # minecraft
|
2024-10-28 11:28:08 +00:00
|
|
|
];
|
|
|
|
};
|
2024-10-24 09:31:32 +00:00
|
|
|
hostName = "theia";
|
2024-12-20 13:11:42 +00:00
|
|
|
nameservers = ["1.1.1.1" "8.8.8.8" "9.9.9.9"];
|
2024-10-24 14:40:25 +00:00
|
|
|
domain = "theia.blahai.gay";
|
2024-10-23 21:03:11 +00:00
|
|
|
useDHCP = lib.mkDefault false;
|
|
|
|
defaultGateway = {
|
|
|
|
address = "178.63.247.183";
|
|
|
|
interface = "ens3";
|
|
|
|
};
|
|
|
|
|
|
|
|
interfaces = {
|
|
|
|
ens3 = {
|
|
|
|
ipv4 = {
|
2024-12-20 13:11:42 +00:00
|
|
|
addresses = [
|
|
|
|
{
|
|
|
|
address = "178.63.118.252";
|
|
|
|
prefixLength = 32;
|
|
|
|
}
|
|
|
|
];
|
2024-10-24 09:31:32 +00:00
|
|
|
|
2024-12-20 13:11:42 +00:00
|
|
|
routes = [
|
|
|
|
{
|
|
|
|
address = "178.63.247.183";
|
|
|
|
prefixLength = 32;
|
|
|
|
}
|
|
|
|
];
|
2024-10-23 21:03:11 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-10-24 09:31:32 +00:00
|
|
|
services = {
|
2024-12-05 14:21:51 +00:00
|
|
|
tailscale = {
|
|
|
|
enable = true;
|
|
|
|
useRoutingFeatures = "server";
|
|
|
|
openFirewall = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
networkd-dispatcher = {
|
|
|
|
enable = true;
|
|
|
|
rules."50-tailscale" = {
|
2024-12-20 13:11:42 +00:00
|
|
|
onState = ["routable"];
|
2024-12-05 14:21:51 +00:00
|
|
|
script = ''
|
2024-12-09 15:04:45 +00:00
|
|
|
${
|
|
|
|
lib.getExe pkgs.ethtool
|
|
|
|
} -K ens3 rx-udp-gro-forwarding on rx-gro-list off
|
2024-12-05 14:21:51 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2024-10-24 14:40:25 +00:00
|
|
|
|
2024-10-28 11:28:08 +00:00
|
|
|
earlyoom = {
|
|
|
|
enable = true;
|
|
|
|
extraArgs = let
|
|
|
|
avoid = lib.concatStringsSep "|" [
|
|
|
|
"cryptsetup"
|
|
|
|
"dbus-.*"
|
|
|
|
"gpg-agent"
|
|
|
|
"ssh-agent"
|
|
|
|
"sshd"
|
|
|
|
"systemd"
|
|
|
|
"systemd-.*"
|
|
|
|
"bash"
|
|
|
|
"fish"
|
|
|
|
"n?vim"
|
|
|
|
];
|
|
|
|
prefer =
|
2024-12-20 13:11:42 +00:00
|
|
|
lib.concatStringsSep "|" ["dotnet" "java.*" "nix" "npm" "node"];
|
2024-10-28 11:28:08 +00:00
|
|
|
in [
|
|
|
|
"-g"
|
|
|
|
"--avoid '(^|/)(${avoid})'" # things that we want to avoid killing
|
|
|
|
"--prefer '(^|/)(${prefer})'" # things we want to remove fast
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-10-24 14:40:25 +00:00
|
|
|
caddy = {
|
|
|
|
enable = true;
|
|
|
|
virtualHosts = {
|
|
|
|
"git.blahai.gay" = {
|
|
|
|
extraConfig = ''
|
|
|
|
reverse_proxy localhost:3000
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
"vault.blahai.gay" = {
|
|
|
|
extraConfig = ''
|
|
|
|
reverse_proxy localhost:8222 {
|
|
|
|
header_up X-Real-IP {remote_host}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
"search.blahai.gay" = {
|
|
|
|
extraConfig = ''
|
|
|
|
reverse_proxy localhost:8888
|
|
|
|
'';
|
|
|
|
};
|
2024-10-25 06:29:48 +00:00
|
|
|
|
2024-11-07 17:18:25 +00:00
|
|
|
"kuma.blahai.gay" = {
|
2024-10-25 06:29:48 +00:00
|
|
|
extraConfig = ''
|
|
|
|
reverse_proxy localhost:3001
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
uptime-kuma = {
|
|
|
|
enable = true;
|
2024-12-20 13:11:42 +00:00
|
|
|
settings = {PORT = "3001";};
|
2024-10-24 14:40:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
forgejo = {
|
2024-10-25 15:55:05 +00:00
|
|
|
package = pkgs.forgejo;
|
2024-10-24 14:40:25 +00:00
|
|
|
enable = true;
|
2024-12-09 15:04:45 +00:00
|
|
|
lfs.enable = true;
|
2024-10-24 14:40:25 +00:00
|
|
|
settings = {
|
2024-12-09 15:04:45 +00:00
|
|
|
"ui.meta" = {
|
|
|
|
AUTHOR = "Elissa";
|
|
|
|
DESCRIPTION = "My own selfhosted git place for random stuff :3";
|
|
|
|
};
|
2024-10-24 14:40:25 +00:00
|
|
|
DEFAULT.APP_NAME = "githai";
|
|
|
|
federation.ENABLED = true;
|
2024-12-09 15:04:45 +00:00
|
|
|
service.DISABLE_REGISTRATION = true;
|
|
|
|
actions = {
|
|
|
|
ENABLED = true;
|
|
|
|
DEFAULT_ACTIONS_URL = "github";
|
|
|
|
};
|
2024-10-24 14:40:25 +00:00
|
|
|
server = {
|
|
|
|
ROOT_URL = "https://git.blahai.gay";
|
|
|
|
DOMAIN = "git.blahai.gay";
|
2024-12-14 16:55:47 +00:00
|
|
|
SSH_PORT = 22;
|
|
|
|
SSH_LISTEN_PORT = 22;
|
2024-10-24 14:40:25 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
vaultwarden = {
|
|
|
|
enable = true;
|
|
|
|
config = {
|
|
|
|
DOMAIN = "https://vault.blahai.gay";
|
|
|
|
ROCKET_PORT = 8222;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
searx = {
|
|
|
|
enable = true;
|
2024-10-28 11:28:08 +00:00
|
|
|
redisCreateLocally = true;
|
2024-10-24 14:40:25 +00:00
|
|
|
settings = {
|
|
|
|
use_default_settings = true;
|
|
|
|
server = {
|
|
|
|
port = 8888;
|
2024-12-20 13:11:42 +00:00
|
|
|
secret_key = "7360d3df7c08ce681cf6d5122e3e182de2c5205e962766abd3e6dfc8dec1b683";
|
2024-10-24 14:40:25 +00:00
|
|
|
};
|
2024-12-20 13:11:42 +00:00
|
|
|
ui = {infinite_scroll = true;};
|
2024-10-28 11:28:08 +00:00
|
|
|
|
2024-10-24 14:40:25 +00:00
|
|
|
general = {
|
|
|
|
instance_name = "searchai";
|
|
|
|
debug = false;
|
|
|
|
};
|
|
|
|
search = {
|
2024-10-28 11:28:08 +00:00
|
|
|
safe_search = 0;
|
2024-10-24 14:40:25 +00:00
|
|
|
autocomplete = "google";
|
|
|
|
default_lang = "en";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-10-24 09:31:32 +00:00
|
|
|
openssh = {
|
|
|
|
enable = true;
|
2024-10-24 14:40:25 +00:00
|
|
|
openFirewall = true;
|
2024-12-20 13:11:42 +00:00
|
|
|
settings = {PasswordAuthentication = false;};
|
2024-10-24 09:31:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
fail2ban = {
|
|
|
|
enable = true;
|
|
|
|
maxretry = 5;
|
|
|
|
bantime = "24h"; # Ban IPs for one day on the first ban
|
|
|
|
bantime-increment = {
|
|
|
|
enable = true; # Enable increment of bantime after each violation
|
|
|
|
overalljails = true; # Calculate the bantime based on all the violations
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-12-20 13:11:42 +00:00
|
|
|
programs = {nix-ld.enable = true;};
|
2024-10-28 11:28:08 +00:00
|
|
|
|
2024-10-24 09:31:32 +00:00
|
|
|
users.users.root = {
|
|
|
|
openssh.authorizedKeys.keys = [
|
|
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILPbmiNqoyeKXk/VopFm2cFfEnV4cKCFBhbhyYB69Fuu"
|
|
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILLqPq70t6RbnI8UejEshYcfBP66I4OrLFjvGLLfIEXD"
|
|
|
|
];
|
2024-12-20 13:11:42 +00:00
|
|
|
initialHashedPassword = "$y$j9T$TzqbL4iMGLjli6EEXfRCZ0$AhFJ4iCFxRlstth5owic3M5nq74Sp1qhtctjSBcgAl8";
|
2024-10-23 21:03:11 +00:00
|
|
|
};
|
|
|
|
|
2024-10-24 09:31:32 +00:00
|
|
|
users.users.pingu = {
|
|
|
|
isNormalUser = true;
|
2024-12-20 13:11:42 +00:00
|
|
|
extraGroups = ["wheel"];
|
2024-10-23 21:03:11 +00:00
|
|
|
openssh.authorizedKeys.keys = [
|
2024-10-24 09:31:32 +00:00
|
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILPbmiNqoyeKXk/VopFm2cFfEnV4cKCFBhbhyYB69Fuu"
|
|
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILLqPq70t6RbnI8UejEshYcfBP66I4OrLFjvGLLfIEXD"
|
2024-10-23 21:03:11 +00:00
|
|
|
];
|
2024-12-20 13:11:42 +00:00
|
|
|
initialHashedPassword = "$y$j9T$cxwKGmzYyC1eLeIysr8r/.$dsxxxV4NvXY.Wpd9LO.RiuMQuy2lYyy2HGrk52BJX08";
|
2024-10-23 21:03:11 +00:00
|
|
|
};
|
2024-10-24 09:31:32 +00:00
|
|
|
|
2024-10-28 11:28:08 +00:00
|
|
|
users.users.minecraft = {
|
|
|
|
isNormalUser = true;
|
|
|
|
openssh.authorizedKeys.keys = [
|
|
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILPbmiNqoyeKXk/VopFm2cFfEnV4cKCFBhbhyYB69Fuu" # nyx
|
|
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILLqPq70t6RbnI8UejEshYcfBP66I4OrLFjvGLLfIEXD" #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/dEMyb6TUKm1zUfRRnTCTngr7WZAn/UcPDvwUduJu64h99TRWOtU9T2ih33xkfk3zCJpME5s=" # slogo desktop
|
2024-10-28 11:28:08 +00:00
|
|
|
];
|
|
|
|
packages = with pkgs; [
|
|
|
|
openjdk21
|
|
|
|
openjdk17
|
|
|
|
screen
|
|
|
|
];
|
2024-12-20 13:11:42 +00:00
|
|
|
initialHashedPassword = "$y$j9T$KpQYYLB6eWfHAUo9.o/uy1$gnj/UlWLrx5XBZDm2GNdjHs2G5D3XxxqqtrCIf5MX43";
|
2024-10-28 11:28:08 +00:00
|
|
|
};
|
|
|
|
|
2024-10-24 09:31:32 +00:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
git
|
|
|
|
curl
|
|
|
|
bat
|
|
|
|
neovim
|
|
|
|
btop
|
|
|
|
zip
|
|
|
|
jq
|
|
|
|
busybox
|
2024-10-28 11:28:08 +00:00
|
|
|
fish
|
2024-12-05 14:21:51 +00:00
|
|
|
ethtool
|
|
|
|
networkd-dispatcher
|
2024-10-24 09:31:32 +00:00
|
|
|
];
|
2024-10-23 21:03:11 +00:00
|
|
|
}
|