[Nix-dev] Building linux kernle with manual-config.nix

Shea Levy shea at shealevy.com
Fri Mar 7 10:06:25 CET 2014


Hey Sergey,

On Fri, Mar 07, 2014 at 12:17:50PM +0400, Sergey Mironov wrote:
> Hi. I am trying to build my own minimalistic kernel with `buildLinux'
> defined in kernel/manual-config.nix. I've written the wrapper
> expression as follows:
> 
> # linuxHandMade.nix
> { stdenv, fetchurl, buildLinux } :
> 
> buildLinux rec {
> 
>   version = "3.10.28";
> 
>   src = fetchurl {
>     url = "mirror://kernel/linux/kernel/v3.x/linux-${version}.tar.xz";
>     sha256 = "1blzvr3qywi8wxgl28zsn5djwgvw70yh3i6qjh2sz3zk9gnpd6mq";
>   };
> 
>   configfile = ./linux-config;
> 
>   allowImportFromDerivation = true;
> }
> 
> where ./linux-config is the .config I have built manually by unpacking
> kernel sources and doing 'make menuconfig'. Everything was OK until I
> disabled the loadable modules support. The ./linux-config now contains
> "# CONFIG_MODULES is not set" and kernel/manual-config.nix doesn't
> work. The error is quite obscure:
> 
> $ nix-build econat.nix -A linuxHandMade  --show-trace
> error: while evaluating `callPackageWith' at
> `/home/grwlf/proj/nixpkgs-econat/lib/customisation.nix:95:35':
> while evaluating `makeOverridable' at
> `/home/grwlf/proj/nixpkgs-econat/lib/customisation.nix:56:24':
> while evaluating an anonymous function at
> `/home/grwlf/proj/nixpkgs-econat/econat/apps/kernel.nix:1:1':
> while evaluating an anonymous function at
> `/home/grwlf/proj/nixpkgs-econat/pkgs/os-specific/linux/kernel/manual-config.nix:13:4':
> while evaluating `mkDerivation' at
> `/home/grwlf/proj/nixpkgs-econat/pkgs/stdenv/generic/default.nix:55:24':
> while evaluating `addPassthru' at
> `/home/grwlf/proj/nixpkgs-econat/lib/customisation.nix:100:22':
> while evaluating an anonymous function at
> `/nix/store/mf69pq5r5948h2q4wj4zfx69rn6zcfk4-nix-1.6.1/share/nix/corepkgs/derivation.nix:4:1':
> value is null while a list was expected
> 

That error is rubbish, and we'll fix that, but currently NixOS is not
intended to support non-modular kernels. See [1] for where the
restriction is specified. Lifting that would take only a little bit of
work, just no one has gotten around to it.

Cheers,
Shea

[1]: https://github.com/NixOS/nixpkgs/blob/6572708d3914a07a1c58f6162b999925ee3d695e/nixos/modules/system/boot/kernel.nix#L289
> 
> I think I've already entered the purely-tested areas of Nixos but
> still could anybody give me a clue of what may go wrong?
> 
> Regards,
> Sergey
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev


More information about the nix-dev mailing list