diff --git a/configuration.nix b/configuration.nix index 0dc9b62..a06c287 100644 --- a/configuration.nix +++ b/configuration.nix @@ -173,8 +173,16 @@ options = "--delete-older-than 30d"; }; + # Optimize Nix for RAM - use more memory for builds + nix.settings = { + max-jobs = "auto"; # Use all CPU cores + cores = 0; # Use all cores + # Build in RAM via tmpfs (configured above) + build-users-group = "nixbld"; + }; + # Power management for laptop - # Configure lid switch behavior - hybrid-sleep for optimal power management + # Configure lid switch behavior - suspend (no swap needed with 96GB RAM) services.logind = { settings = { Login = { @@ -211,11 +219,38 @@ # Enable power management powerManagement.enable = true; - - # Enable ZRAM swap for better memory management and potentially faster boot - zramSwap = { - enable = true; - algorithm = "zstd"; + + # RAM optimizations for 96GB system + # Disable swap usage (set swappiness to 0) - with 96GB RAM, never need swap + boot.kernel.sysctl = { + "vm.swappiness" = 0; # Never swap to disk + "vm.vfs_cache_pressure" = 50; # Keep more filesystem cache in RAM + "vm.dirty_ratio" = 15; # Write to disk when 15% of RAM is dirty + "vm.dirty_background_ratio" = 5; # Start writing when 5% dirty + }; + + # Use RAM disk (tmpfs) for temporary files - much faster than disk + fileSystems."/tmp" = { + device = "tmpfs"; + fsType = "tmpfs"; + options = [ + "size=32G" # Use up to 32GB RAM for /tmp (adjust as needed) + "mode=1777" + "nosuid" + "nodev" + ]; + }; + + # RAM disk for Nix build cache - speeds up compilation significantly + fileSystems."/tmp/nix-build" = { + device = "tmpfs"; + fsType = "tmpfs"; + options = [ + "size=32G" # 32GB for Nix builds + "mode=1777" + "nosuid" + "nodev" + ]; }; # List packages installed in system profile. To search, run: diff --git a/flake.lock b/flake.lock index 2fbf549..ec65da8 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1762463325, - "narHash": "sha256-33YUsWpPyeBZEWrKQ2a1gkRZ7i0XCC/2MYpU6BVeQSU=", + "lastModified": 1762964643, + "narHash": "sha256-RYHN8O/Aja59XDji6WSJZPkJpYVUfpSkyH+PEupBJqM=", "owner": "nix-community", "repo": "home-manager", - "rev": "0562fef070a1027325dd4ea10813d64d2c967b39", + "rev": "827f2a23373a774a8805f84ca5344654c31f354b", "type": "github" }, "original": { @@ -43,11 +43,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1762463231, - "narHash": "sha256-hv1mG5j5PTbnWbtHHomzTus77pIxsc4x8VrMjc7+/YE=", + "lastModified": 1762847253, + "narHash": "sha256-BWWnUUT01lPwCWUvS0p6Px5UOBFeXJ8jR+ZdLX8IbrU=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "52113c4f5cfd1e823001310e56d9c8d0699a6226", + "rev": "899dc449bc6428b9ee6b3b8f771ca2b0ef945ab9", "type": "github" }, "original": { @@ -58,11 +58,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1762363567, - "narHash": "sha256-YRqMDEtSMbitIMj+JLpheSz0pwEr0Rmy5mC7myl17xs=", + "lastModified": 1762844143, + "narHash": "sha256-SlybxLZ1/e4T2lb1czEtWVzDCVSTvk9WLwGhmxFmBxI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ae814fd3904b621d8ab97418f1d0f2eb0d3716f4", + "rev": "9da7f1cf7f8a6e2a7cb3001b048546c92a8258b4", "type": "github" }, "original": { @@ -88,11 +88,11 @@ ] }, "locked": { - "lastModified": 1762482908, - "narHash": "sha256-/Bsw5brCo8gbV5rgK2+SVMrVFasnE5LgJLZertAxdsc=", + "lastModified": 1762903129, + "narHash": "sha256-4vxtwKSBiiJ950ccLo8kQvBGwyNjhglOgWI5b/sjGXY=", "owner": "0xc000022070", "repo": "zen-browser-flake", - "rev": "45b88a529bd410aeba3d28f8396901d57f8b32d4", + "rev": "d03a5917aef22219df1f97b6da6fe5b8039be8de", "type": "github" }, "original": { diff --git a/home.nix b/home.nix index 896be6a..ff13e8c 100644 --- a/home.nix +++ b/home.nix @@ -76,7 +76,6 @@ google-chrome tor-browser mullvad-vpn - element-desktop font-manager handbrake libreoffice-qt