Last active
June 11, 2024 14:23
-
-
Save Panky-codes/59a5684cccdf5f4f811782e222cac330 to your computer and use it in GitHub Desktop.
Building custom kernel in NixOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs, ... }: | |
# Modified version of pkgs.linuxPackages_custom to accept kernelPatches | |
let | |
customPackage = { version, src, configfile, modDirVersion ? pkgs.lib.versions.pad 3 version, kernelPatches ? [ ], allowImportFromDerivation ? true }: | |
pkgs.lib.recurseIntoAttrs (pkgs.linuxPackagesFor (pkgs.linuxManualConfig { | |
inherit version src configfile modDirVersion kernelPatches allowImportFromDerivation; | |
})); | |
in | |
customPackage { | |
version = "6.10.0-rc3-bcache"; | |
modDirVersion = "6.10.0-rc3"; | |
configfile = ./config_6_10_rc3; | |
src = pkgs.fetchurl { | |
url = "https://git.kernel.org/torvalds/t/linux-6.10-rc3.tar.gz"; | |
hash = "sha256-z5Z89iBz9YojSC3RpXlEPjqXhXCt1AIxqlK7DL9lnkg="; | |
}; | |
kernelPatches = [{ | |
name = "bcachefs"; | |
patch = ./bcachefs.patch; | |
}]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
... | |
boot.initrd.includeDefaultModules = false; #Optional if you don't want all the default modules | |
boot.kernelPackages = import ./custom-kernel.nix { inherit pkgs; }; | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment