summary refs log tree commit diff
path: root/nixos/modules/system/boot/modprobe.nix
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2015-01-06 02:49:57 +0300
committerNikolay Amiantov <ab@fmap.me>2015-01-06 16:39:00 +0300
commit2aaeacc57923db53a18db6f089d6da9b86f5a9b8 (patch)
tree342f1dc1075a030f07bc78fd9332b5047b835948 /nixos/modules/system/boot/modprobe.nix
parentebf4d5c62baaa9a78a42cb96746886e367c5158e (diff)
downloadnixlib-2aaeacc57923db53a18db6f089d6da9b86f5a9b8.tar
nixlib-2aaeacc57923db53a18db6f089d6da9b86f5a9b8.tar.gz
nixlib-2aaeacc57923db53a18db6f089d6da9b86f5a9b8.tar.bz2
nixlib-2aaeacc57923db53a18db6f089d6da9b86f5a9b8.tar.lz
nixlib-2aaeacc57923db53a18db6f089d6da9b86f5a9b8.tar.xz
nixlib-2aaeacc57923db53a18db6f089d6da9b86f5a9b8.tar.zst
nixlib-2aaeacc57923db53a18db6f089d6da9b86f5a9b8.zip
nixos/modprobe: wrap all of kmod
Diffstat (limited to 'nixos/modules/system/boot/modprobe.nix')
-rw-r--r--nixos/modules/system/boot/modprobe.nix15
1 files changed, 11 insertions, 4 deletions
diff --git a/nixos/modules/system/boot/modprobe.nix b/nixos/modules/system/boot/modprobe.nix
index eaf8cf1ecd6f..a1feaad6132d 100644
--- a/nixos/modules/system/boot/modprobe.nix
+++ b/nixos/modules/system/boot/modprobe.nix
@@ -10,10 +10,18 @@ with lib;
 
     system.sbin.modprobe = mkOption {
       internal = true;
-      default = pkgs.writeTextFile {
+      default = pkgs.stdenv.mkDerivation {
         name = "modprobe";
-        destination = "/sbin/modprobe";
-        executable = true;
+        buildCommand = ''
+          mkdir -p $out/bin
+          for i in ${pkgs.kmod}/sbin/*; do
+            name=$(basename $i)
+            echo "$text" > $out/bin/$name
+            echo 'exec '$i' "$@"' >> $out/bin/$name
+            chmod +x $out/bin/$name
+          done
+          ln -s bin $out/sbin
+        '';
         text =
           ''
             #! ${pkgs.stdenv.shell}
@@ -26,7 +34,6 @@ with lib;
                 MODULE_DIR=/run/booted-system/kernel-modules/lib/modules/
             fi
 
-            exec ${pkgs.kmod}/sbin/modprobe "$@"
           '';
       };
       description = ''