diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 0b9124709f85..56b87de1f394 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -792,6 +792,10 @@ in path = [ pkgs.util-linux ]; overrideStrategy = "asDropin"; }; + systemd.services."modprobe@" = { + restartIfChanged = false; + serviceConfig.ExecSearchPath = lib.makeBinPath [ pkgs.kmod ]; + }; systemd.services.systemd-random-seed.restartIfChanged = false; systemd.services.systemd-remount-fs.restartIfChanged = false; systemd.services.systemd-update-utmp.restartIfChanged = false; diff --git a/nixos/tests/systemd-misc.nix b/nixos/tests/systemd-misc.nix index 2623f78add63..30f9fe720059 100644 --- a/nixos/tests/systemd-misc.nix +++ b/nixos/tests/systemd-misc.nix @@ -60,5 +60,10 @@ in machine.succeed("systemctl status example.service | grep 'Active: active'") machine.succeed("systemctl show --property TasksMax --value user-1000.slice | grep 100") + + with subtest("modprobe@ services work"): + modprobe_service_status = machine.succeed("systemctl show --property ExecMainStatus modprobe@configfs.service") + print(modprobe_service_status) + t.assertEqual("ExecMainStatus=0\n", modprobe_service_status) ''; }