TO RESEARCH:
- https://github.com/cachix/git-hooks.nix
- fstrim
- https://github.com/oddlama/nix-topology
Your config: Performance-focused tuning for high-end desktop (128GB RAM, 1 Gbps network, audio production) nix-mineral: Security-focused hardening module (may break desktop functionality)
- Your config:
mitigations=off(performance priority) - nix-mineral:
mitigations=auto,nosmt(security priority) - Impact: nix-mineral disables SMT (hyperthreading), reducing performance by ~30% on Ryzen CPUs
- Recommendation: Keep your setting for desktop use
- Your config: Not explicitly disabled (may be needed for VMs/containers)
- nix-mineral:
net.ipv4.ip_forward = 0(security) - Impact: Breaks VM networking, Docker, containers
- Recommendation: Keep current (don't disable if using virtualization)
- Your config:
net.ipv4.tcp_timestamps = 1(performance) - nix-mineral:
net.ipv4.tcp_timestamps = 1(same, but notes privacy concern) - Status: ✅ Compatible
- Your config:
net.ipv4.tcp_sack = 1(performance) - nix-mineral:
net.ipv4.tcp_sack = 0(security - prevents some attacks) - Impact: Reduces network performance on high-latency links
- Recommendation: Keep your setting for performance
boot.kernel.sysctl = {
# Restrict ptrace (Yama)
"kernel.yama.ptrace_scope" = "1"; # You may want "2" for stricter
# Disable magic sysrq (security)
"kernel.sysrq" = "0";
# Disable binfmt (breaks Rosetta/Wine, but more secure)
"fs.binfmt_misc.status" = "0"; # ⚠️ May break some apps
# Disable io_uring (many vulnerabilities)
"kernel.io_uring_disabled" = "2"; # ⚠️ May break some apps
# Restrict dmesg access
"kernel.dmesg_restrict" = "1";
# Restrict kernel pointer access
"kernel.kptr_restrict" = "2";
# Restrict perf subsystem
"kernel.perf_event_paranoid" = "3";
"kernel.perf_cpu_time_max_percent" = "1";
"kernel.perf_event_max_sample_rate" = "1";
# Disable unprivileged BPF
"kernel.unprivileged_bpf_disabled" = "1";
# Harden BPF JIT
"net.core.bpf_jit_harden" = "2";
# Disable kexec (prevent kernel replacement attacks)
"kernel.kexec_load_disabled" = "1";
# Restrict printk
"kernel.printk" = "3 3 3 3";
# Disable core dumps
"kernel.core_pattern" = "|/bin/false";
"fs.suid_dumpable" = "0";
# ASLR
"kernel.randomize_va_space" = "2";
# Memory protection
"vm.mmap_min_addr" = "65536";
"vm.mmap_rnd_bits" = "32";
"vm.mmap_rnd_compat_bits" = "16";
"vm.unprivileged_userfaultfd" = "0";
# Filesystem protection
"fs.protected_fifos" = "2";
"fs.protected_hardlinks" = "1";
"fs.protected_regular" = "2";
"fs.protected_symlinks" = "1";
# Disable TTY autoload
"dev.tty.ldisc_autoload" = "0";
};boot.kernel.sysctl = {
# You already have these ✅:
# - net.ipv4.conf.all.rp_filter = 1
# - net.ipv4.conf.all.accept_source_route = 0
# - net.ipv4.conf.all.accept_redirects = 0
# - net.ipv4.conf.all.send_redirects = 0
# - net.ipv4.conf.all.log_martians = 1
# Additional IPv6 security (you're missing):
"net.ipv6.conf.all.accept_redirects" = "0";
"net.ipv6.conf.default.accept_redirects" = "0";
"net.ipv6.conf.all.accept_source_route" = "0";
"net.ipv6.conf.default.accept_source_route" = "0";
"net.ipv6.conf.all.accept_ra" = "0";
"net.ipv6.conf.default.accept_ra" = "0";
"net.ipv6.conf.all.router_solicitations" = "0";
"net.ipv6.conf.all.accept_ra_rtr_pref" = "0";
"net.ipv6.conf.all.accept_ra_pinfo" = "0";
"net.ipv6.conf.all.accept_ra_defrtr" = "0";
"net.ipv6.conf.all.autoconf" = "0";
"net.ipv6.conf.all.dad_transmits" = "0";
"net.ipv6.conf.all.max_addresses" = "1";
"net.ipv6.icmp.echo_ignore_all" = "1";
"net.ipv6.icmp.echo_ignore_anycast" = "1";
"net.ipv6.icmp.echo_ignore_multicast" = "1";
# ICMP security
"net.ipv4.icmp_echo_ignore_all" = "1"; # You have ignore_broadcasts, but not all
"net.ipv4.icmp_ignore_bogus_error_responses" = "1";
# ARP security
"net.ipv4.conf.all.arp_announce" = "2";
"net.ipv4.conf.default.arp_announce" = "2";
"net.ipv4.conf.all.arp_ignore" = "1";
"net.ipv4.conf.default.arp_ignore" = "1";
"net.ipv4.conf.all.drop_gratuitous_arp" = "1";
"net.ipv4.conf.default.drop_gratuitous_arp" = "1";
"net.ipv4.conf.all.shared_media" = "0";
"net.ipv4.conf.default.shared_media" = "0";
# TCP security (some conflict with your performance settings)
"net.ipv4.tcp_dsack" = "0"; # ⚠️ Conflicts with your performance tuning
"net.ipv4.tcp_fack" = "0"; # ⚠️ Conflicts with your performance tuning
"net.ipv4.tcp_rfc1337" = "1";
"net.ipv4.tcp_syncookies" = "1"; # ✅ Good, doesn't hurt performance
};# These mount options are VERY restrictive and may break desktop apps:
fileSystems."/home" = {
options = [ "bind" "nosuid" "noexec" "nodev" ]; # ⚠️ noexec breaks many apps
};
fileSystems."/tmp" = {
options = [ "bind" "nosuid" "noexec" "nodev" ]; # ⚠️ Breaks many apps
};
fileSystems."/var" = {
options = [ "bind" "nosuid" "noexec" "nodev" ]; # ⚠️ May break some services
};
boot.specialFileSystems."/dev/shm" = {
options = [ "noexec" ]; # ⚠️ Breaks some applications
};
boot.specialFileSystems."/proc" = {
options = [ "hidepid=2" "gid=..." ]; # ⚠️ Breaks many desktop tools
};Recommendation: ❌ Don't add these - too restrictive for desktop use
boot.kernelParams = [
"module.sig_enforce=1" # ⚠️ Breaks out-of-tree modules (NVIDIA, etc.)
"lockdown=confidentiality" # ⚠️ Very restrictive, breaks many things
"efi=disable_early_pci_dma" # ⚠️ May prevent boot on some systems
"iommu.passthrough=0" # ⚠️ Breaks GPU passthrough
"mitigations=auto,nosmt" # ⚠️ Disables SMT (30% performance loss)
"pti=on" # ⚠️ Performance impact
"slab_nomerge" # ⚠️ May cause issues
"init_on_alloc=1" # ⚠️ Performance impact
"init_on_free=1" # ⚠️ Performance impact
"vsyscall=none" # ⚠️ Breaks some old binaries
"debugfs=off" # ⚠️ Breaks debugging tools
"oops=panic" # ⚠️ System will panic on kernel errors
"quiet" "loglevel=0" # ⚠️ Hides all boot messages
"random.trust_cpu=off" # ⚠️ Slower entropy
"random.trust_bootloader=off" # ⚠️ Slower entropy
];Recommendation: ❌ Don't add these - conflicts with your performance goals
- Kernel security restrictions (ptrace, dmesg, perf, BPF)
- IPv6 security hardening (you're missing these)
- ICMP security improvements
- ARP security settings
- Filesystem protection flags (protected_fifos, protected_symlinks, etc.)
- Memory protection settings (mmap_min_addr, etc.)
fs.binfmt_misc.status = 0- Breaks Wine/Rosettakernel.io_uring_disabled = 2- Breaks some modern apps- TCP security settings that conflict with your performance tuning
- CPU mitigations (you have
mitigations=off) - Filesystem mount restrictions (
noexecon/home,/tmp, etc.) /prochiding (hidepid=2)- Kernel lockdown mode
- Module signature enforcement (if using proprietary drivers)
- Network forwarding restrictions (if using VMs/containers)
Would you like me to:
- Create a new security module with the safe additions?
- Add security settings directly to your existing
sysctl.nix? - Create a separate security module that can be optionally enabled?