diff --git a/modules/system/boot/stage-1.nix b/modules/system/boot/stage-1.nix index 265adf163fc..d7925c0f7d3 100644 --- a/modules/system/boot/stage-1.nix +++ b/modules/system/boot/stage-1.nix @@ -121,6 +121,20 @@ let enableSplashScreen = config.boot.vesa && config.boot.initrd.enableSplashScreen && kernelPackages.splashutils != null; + needsCifsUtils = kernelPackages.kernel ? features + && kernelPackages.kernel.features ? needsCifsUtils + && kernelPackages.kernel.features.needsCifsUtils + && any (fs: fs.fsType == "cifs") fileSystems; + + busybox = if needsCifsUtils + then pkgs.busybox.override { + extraConfig = '' + CONFIG_FEATURE_MOUNT_CIFS n + CONFIG_FEATURE_MOUNT_HELPERS y + ''; + } + else pkgs.busybox; + # Some additional utilities needed in stage 1, like mount, lvm, fsck # etc. We don't want to bring in all of those packages, so we just @@ -146,7 +160,7 @@ let cp -pv ${pkgs.gcc.gcc}/lib*/libgcc_s.so.* $out/lib # Copy BusyBox. - cp -rvd ${pkgs.busybox}/{bin,sbin} $out/ + cp -rvd ${busybox}/{bin,sbin} $out/ chmod -R u+w $out # Copy some utillinux stuff. @@ -175,6 +189,11 @@ let cp ${kernelPackages.splashutils}/${kernelPackages.splashutils.helperName} $out/bin/splash_helper ''} + # Maybe copy cifs utils + ${optionalString needsCifsUtils '' + cp -v ${pkgs.cifs_utils}/sbin/mount.cifs $out/bin + ''} + ${config.boot.initrd.extraUtilsCommands} # Strip binaries further than normal.