summary refs log tree commit diff
diff options
context:
space:
mode:
authorrnhmjoj <rnhmjoj@inventati.org>2021-02-26 21:37:33 +0100
committerrnhmjoj <rnhmjoj@inventati.org>2021-02-26 22:10:10 +0100
commit48052ca0dd1939beed30dc8c65f541cfa05704fa (patch)
treed00da6e42abd53bf36f6001b5a7129ac708a29b3
parented0a29c88dfe32f3121474ce5cad7df02e28c2cc (diff)
downloadnixpkgs-48052ca0dd1939beed30dc8c65f541cfa05704fa.tar
nixpkgs-48052ca0dd1939beed30dc8c65f541cfa05704fa.tar.gz
nixpkgs-48052ca0dd1939beed30dc8c65f541cfa05704fa.tar.bz2
nixpkgs-48052ca0dd1939beed30dc8c65f541cfa05704fa.tar.lz
nixpkgs-48052ca0dd1939beed30dc8c65f541cfa05704fa.tar.xz
nixpkgs-48052ca0dd1939beed30dc8c65f541cfa05704fa.tar.zst
nixpkgs-48052ca0dd1939beed30dc8c65f541cfa05704fa.zip
nixos/ksm: remove udev-settle dependency
The sysfs file /sys/kernel/mm/ksm/run seems to be available as soon as
the kernel has started, so no point in waiting for udev to "settle". If
for some reason it doesn't, we let the unit fail explicitly.
-rw-r--r--nixos/modules/hardware/ksm.nix12
-rw-r--r--nixos/tests/ksm.nix4
2 files changed, 8 insertions, 8 deletions
diff --git a/nixos/modules/hardware/ksm.nix b/nixos/modules/hardware/ksm.nix
index 0938dbdc110..829c3532c45 100644
--- a/nixos/modules/hardware/ksm.nix
+++ b/nixos/modules/hardware/ksm.nix
@@ -26,13 +26,13 @@ in {
     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
+      script =
+        ''
           echo 1 > /sys/kernel/mm/ksm/run
-          ${optionalString (cfg.sleep != null) ''echo ${toString cfg.sleep} > /sys/kernel/mm/ksm/sleep_millisecs''}
-        fi
-      '';
+        '' + optionalString (cfg.sleep != null)
+        ''
+          echo ${toString cfg.sleep} > /sys/kernel/mm/ksm/sleep_millisecs
+        '';
     };
   };
 }
diff --git a/nixos/tests/ksm.nix b/nixos/tests/ksm.nix
index 8feccbe6df5..8f84b32020a 100644
--- a/nixos/tests/ksm.nix
+++ b/nixos/tests/ksm.nix
@@ -1,8 +1,8 @@
-import ./make-test-python.nix ({ pkgs, ...} :
+import ./make-test-python.nix ({ lib, ...} :
 
 {
   name = "ksm";
-  meta = with pkgs.lib.maintainers; {
+  meta = with lib.maintainers; {
     maintainers = [ rnhmjoj ];
   };