Re: [Nix-dev] Has someone a working setup for Kernel development with NixOS?
Hi, so here is what I've got so far... maybe my approach is nonsense, but I don't know that (yet... feel free to point me to a better one). It doesn't work, though, as I get: error: value is a function while a set was expected and I don't know why. Here is my custom-kernel.nix. The imports are simply things which should be in a normal configuration.nix. Maybe someone of you has a good idea how to get this working. -8<- { config, pkgs, ... }: let configDir = /home/m/config/nixos; nixpkgsClone = /home/m/dev/contrib/nixpkgs; kernelSrc = "../linux/"; kernelVersion = "4.7-custom"; customKernelFn = { stdenv, fetchurl, perl, buildLinux, ... } @ args: import "${nixpkgsClone}/pkgs/os-specific/linux/kernel/generic.nix" (args // { version = kernelVersion; extraMeta.branch = "master"; src = kernelSrc; kernelPatches = pkgs.kernelPatches; features.iwlwifi = true; features.efiBootStub = true; features.needsCifsUtils = true; features.canDisableNetfilterConntrackHelpers = true; features.netfilterRPFilter = true; }) ; customKernel = customKernelFn { stdenv = pkgs.stdenv; fetchurl = pkgs.fetchurl; perl = pkgs.perl; buildLinux = pkgs.buildLinux; kernelPatches = with pkgs.kernelPatches; [ kernelPatches.bridge_stp_helper kernelPatches.qat_common_Makefile kernelPatches.hiddev_CVE_2016_5829 ] ++ lib.optionals ((platform.kernelArch or null) == "mips") [ kernelPatches.mips_fpureg_emu kernelPatches.mips_fpu_sigill kernelPatches.mips_ext3_n32 ]; }; customKernelPackages = pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor customKernel pkgs.linuxPackages_custom); in { imports = [ # Base configuration "${configDir}/base-configuration.nix" # Program configuration "${configDir}/programs/default.nix" # Filesystem additions "${configDir}/fs/yuu.nix" # Users "${configDir}/users/m.nix" # Services "${configDir}/services/sshServer.nix" "${configDir}/services/x.nix" ]; boot.kernelPackages = customKernelPackages; # Define on which hard drive you want to install Grub. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usb_storage" ]; boot.initrd.kernelModules = [ "fbcon" "kvm-intel" ]; boot.initrd.luks.cryptoModules = [ "aes" "sha256" "sha1" "cbc" ]; networking = { hostName = "yuu-kernelvm"; nameservers = [ "8.8.8.8" "8.8.4.4" ]; wireless.enable = false; useDHCP = false; }; nixpkgs.config.allowUnfree = false; environment.variables = { CONFIG_DIR = "~/config"; EDITOR = "nvim"; }; environment.systemPackages = let basePkgs= import "${configDir}/pkgs/basePackages.nix" pkgs; analyzePkgs = import "${configDir}/pkgs/analyzePackages.nix" pkgs; devPkgs = import "${configDir}/pkgs/devPackages.nix" pkgs; docPkgs = import "${configDir}/pkgs/docPackages.nix" pkgs; networkingPkgs = import "${configDir}/pkgs/networkingPackages.nix" pkgs; nvimPkgs = import "${configDir}/pkgs/neovim.nix" pkgs; in basePkgs ++ analyzePkgs ++ devPkgs ++ docPkgs ++ networkingPkgs ++ nvimPkgs; } ->8- On 27-06-2016 21:50:38, Layus wrote: > Hi, > > Basically you need to build the vm attribute from > /nixos/default.nix. > > You can do this with > nix-build /path/to/nixpkgs/nixos -A vm > or even with > nixos-rebuild build-vm > > You also need to specify an alternate nixos config, which you can do using > > NIXOS_CONFIG=/path/to/custom/configuration.nix > or using nixos-config in nix-path (as below). > > For your setup, the simplest way may be to > > NIXOS_CONFIG=/my/configuration.nix nixos-rebuild build-vm > > Anyway, you will obtain a script to start the vm. > > Now, bear in mind that the vm is started with QEMU & KVM, so you may need to > tune the options if you want your developpment kernel to be fully used. > Read the produced script if you want more insight into qemu options. > If I remember well, in my setup the network stack of the guest was not used, > the host kernel was used instead, even in the VM. > I am no expert, so I may be wrong. Just keep it in mind if you experience > strange results. > > You may also need to avoid full
Re: [Nix-dev] Has someone a working setup for Kernel development with NixOS?
On Mon, Jun 27, 2016, at 08:52 PM, Matthias Beyer wrote: > basically what I do with `nixos-rebuild build-vm` but from another > configuration.nix than my system-configuration.nix. You probably want something like ``` $ nix-build -I nixpkgs=/my/nixpkgs -I nixos-config=/my/configuration.nix '' -A vm $ ./result/bin/run-nixos-vm ``` or some variation thereof. HTH, Joachim ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] Has someone a working setup for Kernel development with NixOS?
This looks like a starting point, but what I want to do is to build a full "nixos-rebuild build-vm"-VM with it - so I have some X-Server running, some browser installed and so on. basically what I do with `nixos-rebuild build-vm` but from another configuration.nix than my system-configuration.nix. Is there a way to do this? I already found `pkgs.linuxPackages_custom` which can be used to do this, but I don't know how I can call the .nix file now to build a qemu VM with it... Maybe some pointers? On 27-06-2016 18:45:42, Domen Kožar wrote: > Forgot to answer, thanks for the ping: > https://github.com/NixOS/nixpkgs/issues/14721 > > On Mon, Jun 27, 2016, 20:30 Matthias Beyerwrote: > > > Hi there, > > > > so I'm sending a PING on this because nobody responded. This will be > > my only PING (as I'm really interested in doing this) and I will not > > send any further PINGs on this, as it might be too much noise for some > > people in here. > > > > On 18-06-2016 20:16:48, Matthias Beyer wrote: > > > Hi, > > > > > > I want to get my feet wet with kernel development after my bachelors > > > thesis and maybe someone has a working setup for kernel dev with > > > NixOS. > > > > > > I especially think about doing a `nixos-rebuild build-vm` with a > > > self-compiled kernel, so what I'm looking for is something like this: > > > > > > A way to build a QEMU VM with all my stuff installed (what > > > `nixos-rebuild build-vm` does) _without_ changing my > > > configuration.nix > > > > > > Does someone of you people on this list have a setup for this? Does > > > someone have a suggestion how to do this? > > > > > > I'm also thinking about using build machines for this and so on ... > > > > > > --- snip --- > > > > > > Of course you can do all these things without nixos, but I kinda like > > > the idea of doing it with nixos tools so I can have my system > > > services, programs and so on be tested in the VM without having to do > > > much setup on my own. > > > > -- > > Mit freundlichen Grüßen, > > Kind regards, > > Matthias Beyer > > > > Proudly sent with mutt. > > Happily signed with gnupg. > > ___ > > nix-dev mailing list > > nix-dev@lists.science.uu.nl > > http://lists.science.uu.nl/mailman/listinfo/nix-dev > > -- Mit freundlichen Grüßen, Kind regards, Matthias Beyer Proudly sent with mutt. Happily signed with gnupg. signature.asc Description: PGP signature ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] Has someone a working setup for Kernel development with NixOS?
Forgot to answer, thanks for the ping: https://github.com/NixOS/nixpkgs/issues/14721 On Mon, Jun 27, 2016, 20:30 Matthias Beyerwrote: > Hi there, > > so I'm sending a PING on this because nobody responded. This will be > my only PING (as I'm really interested in doing this) and I will not > send any further PINGs on this, as it might be too much noise for some > people in here. > > On 18-06-2016 20:16:48, Matthias Beyer wrote: > > Hi, > > > > I want to get my feet wet with kernel development after my bachelors > > thesis and maybe someone has a working setup for kernel dev with > > NixOS. > > > > I especially think about doing a `nixos-rebuild build-vm` with a > > self-compiled kernel, so what I'm looking for is something like this: > > > > A way to build a QEMU VM with all my stuff installed (what > > `nixos-rebuild build-vm` does) _without_ changing my > > configuration.nix > > > > Does someone of you people on this list have a setup for this? Does > > someone have a suggestion how to do this? > > > > I'm also thinking about using build machines for this and so on ... > > > > --- snip --- > > > > Of course you can do all these things without nixos, but I kinda like > > the idea of doing it with nixos tools so I can have my system > > services, programs and so on be tested in the VM without having to do > > much setup on my own. > > -- > Mit freundlichen Grüßen, > Kind regards, > Matthias Beyer > > Proudly sent with mutt. > Happily signed with gnupg. > ___ > nix-dev mailing list > nix-dev@lists.science.uu.nl > http://lists.science.uu.nl/mailman/listinfo/nix-dev > ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] Has someone a working setup for Kernel development with NixOS?
Hi there, so I'm sending a PING on this because nobody responded. This will be my only PING (as I'm really interested in doing this) and I will not send any further PINGs on this, as it might be too much noise for some people in here. On 18-06-2016 20:16:48, Matthias Beyer wrote: > Hi, > > I want to get my feet wet with kernel development after my bachelors > thesis and maybe someone has a working setup for kernel dev with > NixOS. > > I especially think about doing a `nixos-rebuild build-vm` with a > self-compiled kernel, so what I'm looking for is something like this: > > A way to build a QEMU VM with all my stuff installed (what > `nixos-rebuild build-vm` does) _without_ changing my > configuration.nix > > Does someone of you people on this list have a setup for this? Does > someone have a suggestion how to do this? > > I'm also thinking about using build machines for this and so on ... > > --- snip --- > > Of course you can do all these things without nixos, but I kinda like > the idea of doing it with nixos tools so I can have my system > services, programs and so on be tested in the VM without having to do > much setup on my own. -- Mit freundlichen Grüßen, Kind regards, Matthias Beyer Proudly sent with mutt. Happily signed with gnupg. signature.asc Description: PGP signature ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
[Nix-dev] Has someone a working setup for Kernel development with NixOS?
Hi, I want to get my feet wet with kernel development after my bachelors thesis and maybe someone has a working setup for kernel dev with NixOS. I especially think about doing a `nixos-rebuild build-vm` with a self-compiled kernel, so what I'm looking for is something like this: A way to build a QEMU VM with all my stuff installed (what `nixos-rebuild build-vm` does) _without_ changing my configuration.nix Does someone of you people on this list have a setup for this? Does someone have a suggestion how to do this? I'm also thinking about using build machines for this and so on ... --- snip --- Of course you can do all these things without nixos, but I kinda like the idea of doing it with nixos tools so I can have my system services, programs and so on be tested in the VM without having to do much setup on my own. -- Mit freundlichen Grüßen, Kind regards, Matthias Beyer Proudly sent with mutt. Happily signed with gnupg. signature.asc Description: PGP signature ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev