Update nixos/configuration.nix

This commit is contained in:
gigirassy
2025-11-16 20:22:03 +01:00
parent a367750006
commit 28efe6189b
+74 -14
View File
@@ -1,10 +1,13 @@
{ config, pkgs, lib, ... }: { { config, pkgs, lib, ... }: {
boot.kernel.sysctl."net.core.rmem_max" = 16777216;
boot.kernel.sysctl."net.core.wmem_max" = 16777216;
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
./networking.nix # generated at runtime by nixos-infect ./networking.nix # generated at runtime by nixos-infect
./modules/smart-ipv6-rotator.nix # ipv6 rotator ./modules/smart-ipv6-rotator.nix
./modules/watchdog.nix # anubis watchdog to auto-report to abuseipdb ./modules/watchdog.nix
]; ];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@@ -43,6 +46,8 @@
programs.starship.enable = true; programs.starship.enable = true;
environment.memoryAllocator.provider = "jemalloc";
# enable sudo; keep password requirement by default # enable sudo; keep password requirement by default
security.sudo.enable = true; security.sudo.enable = true;
security.sudo.wheelNeedsPassword = true; security.sudo.wheelNeedsPassword = true;
@@ -52,6 +57,7 @@
capacity = 50; capacity = 50;
}; };
services.irqbalance.enable = true;
services.yggdrasil = { services.yggdrasil = {
enable = true; enable = true;
@@ -82,7 +88,7 @@
enableIPv4 = true; enableIPv4 = true;
port = 35252; port = 35252;
address = "91.98.126.143" ; address = "91.98.126.143" ;
enableIPv6 = true; # if you don't have IPv6, leave false enableIPv6 = true; # if you dont have IPv6, leave false
ifname = "eth0"; # change to your interface ifname = "eth0"; # change to your interface
bandwidth = 1000; # limit to 500 KB/s (≈ 4 Mb/s) bandwidth = 1000; # limit to 500 KB/s (≈ 4 Mb/s)
share = 50; # allocate 50% of that to transit share = 50; # allocate 50% of that to transit
@@ -105,14 +111,52 @@
sha256 = "sha256-g2M+obfTGya3bPkNRvpptaBIx0X+94262vEfponycTY="; sha256 = "sha256-g2M+obfTGya3bPkNRvpptaBIx0X+94262vEfponycTY=";
}; };
services.cron = {
enable = true; systemd.services.ipfs_restart = {
systemCronJobs = [ description = "Restart ipfs docker container";
"* * * * * /root/trafficgen.sh >> /var/log/generate_traffic_png.log 2>&1" serviceConfig = {
"0 */6 * * * docker restart instafix_proxy" Type = "oneshot";
"0 */12 * * * docker system prune -a -f" ExecStart = "${pkgs.docker}/bin/docker restart ipfs-ipfs-1";
"0 */1 * * * /bin/bash -lc 'for i in {1..10}; do [ -d /srv/arti$i/cache/dir_blobs ] && find /srv/arti$i/cache/dir_blobs -mindepth 1 -maxdepth 1 -exec rm -rf {} +; done'" # clear redlib cache };
]; };
systemd.timers.ipfs_restart = {
wantedBy = [ "timers.target" ];
timerConfig = {
# run roughly every 6 hours after previous run
OnUnitActiveSec = "6h";
Persistent = true;
};
};
systemd.services.instafix_proxy_restart = {
description = "Restart instafix_proxy docker container";
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.docker}/bin/docker restart instafix_proxy";
};
};
systemd.timers.instafix_proxy_restart = {
wantedBy = [ "timers.target" ];
timerConfig = {
# run roughly every 6 hours after previous run
OnUnitActiveSec = "6h";
Persistent = true;
};
};
systemd.services.docker_system_prune = {
description = "Prune docker system";
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.docker}/bin/docker system prune -a -f";
};
};
systemd.timers.docker_system_prune = {
wantedBy = [ "timers.target" ];
timerConfig = { OnUnitActiveSec = "12h"; Persistent = true; };
}; };
services.caddy = { services.caddy = {
@@ -131,6 +175,9 @@
virtualHosts."small.blitzw.in".extraConfig = '' virtualHosts."small.blitzw.in".extraConfig = ''
reverse_proxy localhost:5084 reverse_proxy localhost:5084
''; '';
virtualHosts."rimgo.blitzw.in".extraConfig = ''
reverse_proxy localhost:43000
'';
virtualHosts."pinata.blitzw.in".extraConfig = '' virtualHosts."pinata.blitzw.in".extraConfig = ''
reverse_proxy localhost:4100 reverse_proxy localhost:4100
''; '';
@@ -171,7 +218,7 @@
} }
''; '';
virtualHosts."pin.blitzw.in".extraConfig= '' virtualHosts."pin.blitzw.in".extraConfig= ''
reverse_proxy localhost:6600 redir https://pinata.blitzw.in
''; '';
virtualHosts."search.blitzw.in".extraConfig = '' virtualHosts."search.blitzw.in".extraConfig = ''
reverse_proxy localhost:24999 reverse_proxy localhost:24999
@@ -180,7 +227,7 @@
reverse_proxy localhost:8109 reverse_proxy localhost:8109
''; '';
virtualHosts."twitch.blitzw.in".extraConfig = '' virtualHosts."twitch.blitzw.in".extraConfig = ''
reverse_proxy localhost:5600 respond "404 Not Found" 404
''; '';
virtualHosts."moz.blitzw.in".extraConfig = '' virtualHosts."moz.blitzw.in".extraConfig = ''
reverse_proxy localhost:3012 reverse_proxy localhost:3012
@@ -261,9 +308,22 @@ services.journald.extraConfig = ''
''; '';
# ensure journals are flushed from /run to /var on shutdown so persistence works # ensure journals are flushed from /run to /var on shutdown so persistence works
systemd.services.systemd-journal-flush.enable = true; systemd.services.systemd-journal-flush.enable = true;
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
virtualisation.docker.daemon.settings = {
ipv6 = true;
# Pick an IPv6 subnet for your containers; e.g. fd00::/80 or something from your network
fixed-cidr-v6 = "fd00:dead:beef::/80";
# Optionally, configure default address pools to include both IPv4 and IPv6
default-address-pools = [
{ base = "172.17.0.0/12"; size = 24; } # IPv4 pool
{ base = "10.10.0.0/16"; size = 24; } # optional extra pool (more /24s)
{ base = "fd00:dead:beef::/48"; size = 64; } # IPv6 pool — adjust prefix & size as needed
];
};
boot.tmp.cleanOnBoot = true; boot.tmp.cleanOnBoot = true;
zramSwap.enable = true; zramSwap.enable = true;
networking.hostName = "hooligan"; networking.hostName = "hooligan";