diff --git a/pkgs/os-specific/linux/module-init-tools/aggregator.nix b/pkgs/os-specific/linux/module-init-tools/aggregator.nix index 9779efe3305f..f11642b9a68f 100644 --- a/pkgs/os-specific/linux/module-init-tools/aggregator.nix +++ b/pkgs/os-specific/linux/module-init-tools/aggregator.nix @@ -1,39 +1,28 @@ -args : with args; - let localDefs = builderDefs { - addSbinPath = true; - src = ""; - buildInputs = [module_init_tools]; - configureFlags = []; - } null; /* null is a terminator for sumArgs */ - in with localDefs; -let +{stdenv, module_init_tools, modules}: -doCollect = FullDepEntry ('' -ensureDir $out/lib/modules -cd $out/ -for i in $moduleSources; do - cp -rfs $i/* . - chmod -R u+w . -done -rm -rf nix-support -cd lib/modules/ -rm */modules.* -# linux-* will pass the new kernel version to depmod to take rather than `uname -r` (see man page) -MODULE_DIR=$PWD/ depmod -a $(basename lib/modules/2.*) -cd $out/ -'') [minInit addInputs defEnsureDir]; -in -stdenv.mkDerivation rec { - name = "kernel-modules"; - inherit moduleSources; - builder = writeScript (name + "-builder") - (textClosure localDefs [doCollect doForceShare doPropagate]); - meta = { - description = " - A directory to hold all the modules, including those - built separately from kernel. Later mentioned directories in - moduleSources have higher priority. -"; - inherit src; - }; +stdenv.mkDerivation { + name = "kernel-modules"; + + buildCommand = '' + ensureDir $out/lib/modules + cd $out/ + modules="${toString modules}" + for i in $modules; do + cp -rfs $i/* . + chmod -R u+w . + v=$(cd $i/lib/modules && ls -d *) + if test -n "$version" -a "$v" != "$version"; then + echo "kernel version mismatch: $version versus $v (in the module paths $modules)"; + exit 1 + fi + version=$v + done + echo "kernel version is $version" + rm -rf nix-support + cd lib/modules/ + rm */modules.* + # linux-* will pass the new kernel version to depmod to take rather than `uname -r` (see man page) + MODULE_DIR=$PWD/ ${module_init_tools}/sbin/depmod -a $(basename lib/modules/2.*) + cd $out/ + ''; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 39f8e4484a82..0094b074bc73 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4494,9 +4494,9 @@ let pkgs = rec { inherit fetchurl stdenv; }; - module_aggregation = moduleSources: + aggregateModules = modules: import ../os-specific/linux/module-init-tools/aggregator.nix { - inherit fetchurl stdenv module_init_tools moduleSources builderDefs; + inherit stdenv module_init_tools modules; }; modutils = import ../os-specific/linux/modutils {