Using the custom_kernel.nix
acting as a shell.nix
below I would like to nix-shell ./custom_kernel.nix
and then the steps as listed in Cross-compiling Linux from source:
Click to see custom_kernel.nix listed
{ pkgs ? import <nixpkgs> {}, ... }:
{
boot.kernelPackages = let
linux_wsl_pkg = { fetchurl, buildLinux, ... } @ args:
buildLinux (args // rec {
version = "5.10.102.1";
modDirVersion = version;
src = fetchurl {
url = "https://github.com/microsoft/WSL2-Linux-Kernel/tarball/linux-msft-wsl-${version}";
sha256 = "0000000000000000000000000000000000000000000000000000";
};
kernelPatches = [];
/*extraConfig = ''
CONFIG_USB_ACM y
CONFIG_USBIP_CORE y
CONFIG_USBIP_VHCI_HCD y
CONFIG_USBIP_VHCI_HC_PORTS freefrom "8"
CONFIG_USBIP_VHCI_NR_HCS 1
CONFIG_USBIP_DEBUG y
CONFIG_USB_SERIAL y
'';*/
structuredExtraConfig = with pkgs.lib.kernel; {
USB_AC = yes;
USBIP_CORE = yes;
USBIP_VHCI_HCD = yes;
USBIP_VHCI_HC_PORTS = freeform "8";
USBIP_VHCI_NR_HCS = freeform "1";
USBIP_DEBUG = yes;
USB_SERIAL = yes;
};
ignoreConfigErrors = true;
extraMeta.branch = "5.10";
} // (args.argsOverride or {}));
linux_wsl = pkgs.callPackage linux_wsl_pkg{};
in
pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_wsl);
}
For now I get
error: nix-shell requires a single derivation
Try ‘nix-shell --help’ for more information.