From 7ea51b1c6c390591afd21eb58f6a3fb0de9806e9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra <eelco.dolstra@logicblox.com> Date: Thu, 17 Apr 2014 14:35:05 +0200 Subject: [PATCH] Enable kmod-static-nodes.service This creates static device nodes such as /dev/fuse or /dev/snd/seq. The kernel modules for these devices will be loaded on demand when the device node is opened. --- nixos/modules/system/boot/kernel.nix | 6 ++++++ pkgs/os-specific/linux/systemd/fixes.patch | 12 ++++++++++++ 2 files changed, 18 insertions(+) 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