Files
nixos-config/system/core.nix
T
kiskaadee deb489df45 feat(core): enable zram swap and earlyoom daemon with critical process protection
- Enable ZRAM compressed in-RAM swap to optimize memory pressure management.
- Enable `services.earlyoom` with desktop and system preservation rules (`niri`, `dms`, `systemd`, `sshd`).
2026-09-28 12:04:35 -05:00

84 lines
2.1 KiB
Nix

# ⚙️ Core System Configuration
# Foundational OS settings, bootloader, networking, users, and base system tools.
{ pkgs, inputs, ... }:
{
# Nix settings & Flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.registry.nixpkgs.flake = inputs.nixpkgs;
# Allow installation of unfree packages
nixpkgs.config.allowUnfree = true;
# EFI bootloader configuration
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Host identity & networking
networking.hostName = "laptop";
networking.networkmanager.enable = true;
# Regional and language settings
time.timeZone = "America/Bogota";
i18n.defaultLocale = "en_US.UTF-8";
# Primary user account definition
users.users.kiskaadee = {
isNormalUser = true;
extraGroups = [
"wheel" # Administrative access (sudo)
"docker" # Container management without sudo
"networkmanager" # Network configuration
"lp" # Printer management
"scanner" # Scanner access
];
};
# SSH daemon settings
services.openssh = {
enable = true;
ports = [ 22 ];
settings.PermitRootLogin = "no";
};
# Dynamic binary execution support (for unpatched binaries, language servers, VS Code server)
programs.nix-ld = {
enable = true;
libraries = with pkgs; [
stdenv.cc.cc.lib
zlib
glib
];
};
# 🧠 Memory & Swap Management
# Compressed in-RAM swap prevents synchronous page thrashing and lockups under high memory pressure.
zramSwap = {
enable = true;
};
# 🛡️ Early OOM Killer Daemon
# Intervenes proactively before the kernel freezes, protecting compositor and core session services.
services.earlyoom = {
enable = true;
enableNotifications = true;
extraArgs = [
"--avoid" "^(niri|dms|systemd|sshd)$"
];
};
# System-wide administrative tools
environment.systemPackages = with pkgs; [
cups-pk-helper
system-config-printer
simple-scan
rclone
sops
age
];
# Compatibility state version
system.stateVersion = "26.05";
}