nixos/hardware: Add option to enable KSM.
This is essentially what's been done for the official NixOS build slaves
and I'm using it as well for a few of my machines and my own Hydra
slaves.
Here's the same implementation from the Delft server configurations:
f47c2fc7f8/delft/common.nix (L91-L101)
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
parent
eecb59a805
commit
224ed7e798
18
nixos/modules/hardware/ksm.nix
Normal file
18
nixos/modules/hardware/ksm.nix
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
options.hardware.enableKSM = lib.mkEnableOption "Kernel Same-Page Merging";
|
||||||
|
|
||||||
|
config = lib.mkIf config.hardware.enableKSM {
|
||||||
|
systemd.services.enable-ksm = {
|
||||||
|
description = "Enable Kernel Same-Page Merging";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
after = [ "systemd-udev-settle.service" ];
|
||||||
|
script = ''
|
||||||
|
if [ -e /sys/kernel/mm/ksm ]; then
|
||||||
|
echo 1 > /sys/kernel/mm/ksm/run
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -29,6 +29,7 @@
|
||||||
./hardware/all-firmware.nix
|
./hardware/all-firmware.nix
|
||||||
./hardware/cpu/amd-microcode.nix
|
./hardware/cpu/amd-microcode.nix
|
||||||
./hardware/cpu/intel-microcode.nix
|
./hardware/cpu/intel-microcode.nix
|
||||||
|
./hardware/ksm.nix
|
||||||
./hardware/network/b43.nix
|
./hardware/network/b43.nix
|
||||||
./hardware/network/intel-2100bg.nix
|
./hardware/network/intel-2100bg.nix
|
||||||
./hardware/network/intel-2200bg.nix
|
./hardware/network/intel-2200bg.nix
|
||||||
|
|
Loading…
Reference in a new issue