diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index a90d1f7c2aa4..2e036fafae60 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -147,6 +147,12 @@ in config = mkIf (!config.boot.isContainer) { + systemd.services.kmod-static-nodes = + { wantedBy = [ "sysinit.target" ]; + baseUnit = "${config.systemd.package}/example/systemd/system/kmod-static-nodes.service"; + environment.MODULE_DIR = "/run/booted-system/kernel-modules/lib/modules"; + }; + system.build = { inherit kernel; }; system.modulesTree = [ kernel ] ++ config.boot.extraModulePackages; diff --git a/pkgs/os-specific/linux/systemd/fixes.patch b/pkgs/os-specific/linux/systemd/fixes.patch index 493a9d266d7a..c33d05da55a6 100644 --- a/pkgs/os-specific/linux/systemd/fixes.patch +++ b/pkgs/os-specific/linux/systemd/fixes.patch @@ -181,6 +181,18 @@ index aa853b8..8bcc647 100644 Type=idle Restart=always RestartSec=0 +diff --git a/units/kmod-static-nodes.service.in b/units/kmod-static-nodes.service.in +index 368f980..d0c1bd2 100644 +--- a/units/kmod-static-nodes.service.in ++++ b/units/kmod-static-nodes.service.in +@@ -10,7 +10,6 @@ Description=Create list of required static device nodes for the current kernel + DefaultDependencies=no + Before=sysinit.target systemd-tmpfiles-setup-dev.service + ConditionCapability=CAP_MKNOD +-ConditionPathExists=/lib/modules/%v/modules.devname + + [Service] + Type=oneshot diff --git a/units/local-fs.target b/units/local-fs.target index ae3cedc..0e36840 100644 --- a/units/local-fs.target