diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f1634a6 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "nix-cachyos-kernel"] + path = nix-cachyos-kernel + url = ./nix-cachyos-kernel/ diff --git a/configuration.nix b/configuration.nix index 7d69547..e648e42 100644 --- a/configuration.nix +++ b/configuration.nix @@ -10,6 +10,7 @@ ./hardware-configuration.nix ./hardware.nix ./bootloader.nix + ./kernel.nix ./nix.nix ./users.nix @@ -75,6 +76,7 @@ curl wget cryptsetup + cachix ]; fonts.packages = with pkgs; [ diff --git a/hardware-configuration.nix b/hardware-configuration.nix index 70f59ba..915798a 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -40,8 +40,6 @@ fsType = "vfat"; }; - swapDevices = [ ]; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hardware.nix b/hardware.nix index c5d388a..3ac1ce3 100644 --- a/hardware.nix +++ b/hardware.nix @@ -61,4 +61,18 @@ services.thermald.enable = lib.mkDefault true; powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; + + # RAM Management + zramSwap.enable = true; + systemd.oomd = { + enable = true; # OOM Killer !!! + enableUserSlices = true; + }; + + swapDevices = [ + { + device = "/var/lib/swapfile"; + size = 16 * 1024; # 16 GiB + } + ]; } diff --git a/kernel.nix b/kernel.nix new file mode 100644 index 0000000..0a305e4 --- /dev/null +++ b/kernel.nix @@ -0,0 +1,12 @@ +{ pkgs, system, ... }: +let + cachy-source = import ./nix-cachyos-kernel; + cachy-kernel = + cachy-source.outputs.legacyPackages.x86_64-linux.linuxPackages-cachyos-bore-lto-x86_64-v3; # .linux-cachyos-bore-lto-x86_64-v3; +in +{ + boot.kernelPackages = cachy-kernel; + + nix.settings.substituters = [ "https://attic.xuyh0120.win/lantian" ]; + nix.settings.trusted-public-keys = [ "lantian:EeAUQ+W+6r7EtwnmYjeVwx5kOGEBpjlBfPlzGlTNvHc=" ]; +} diff --git a/nix-cachyos-kernel b/nix-cachyos-kernel new file mode 160000 index 0000000..26da04e --- /dev/null +++ b/nix-cachyos-kernel @@ -0,0 +1 @@ +Subproject commit 26da04e24aef2993ea256917be42d18f83ce8e8b