mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 15:11:25 +00:00
19 lines
472 B
Nix
19 lines
472 B
Nix
|
{ 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
|
||
|
'';
|
||
|
};
|
||
|
};
|
||
|
}
|