make kernel builder callPackage'able

This commit is contained in:
Daniel Barlow 2022-09-25 22:02:45 +01:00
parent a7e54c087c
commit e29d009b2f
3 changed files with 20 additions and 4 deletions

View file

@ -16,7 +16,9 @@ let
; ;
}; };
squashfs = (import ./make-image.nix) nixpkgs finalConfig; squashfs = (import ./make-image.nix) nixpkgs finalConfig;
kernel = (import ./make-kernel.nix) nixpkgs finalConfig.kernel.config; kernel = nixpkgs.pkgs.callPackage ./kernel {
inherit (finalConfig.kernel) config;
};
in { in {
outputs = { outputs = {
inherit squashfs kernel; inherit squashfs kernel;

View file

@ -1,12 +1,26 @@
pkgs: config: {
callPackage
, buildPackages
, stdenvNoCC
, fetchFromGitHub
, config
}:
let let
inherit (pkgs) callPackage buildPackages stdenvNoCC fetchFromGitHub;
source = fetchFromGitHub { source = fetchFromGitHub {
owner = "torvalds"; owner = "torvalds";
repo = "linux"; repo = "linux";
rev = "3d7cb6b04c3f3115719235cc6866b10326de34cd"; # v5.19 rev = "3d7cb6b04c3f3115719235cc6866b10326de34cd"; # v5.19
hash = "sha256-OVsIRScAnrPleW1vbczRAj5L/SGGht2+GnvZJClMUu4="; hash = "sha256-OVsIRScAnrPleW1vbczRAj5L/SGGht2+GnvZJClMUu4=";
}; };
# The kernel is huge and takes a long time just to
# download and unpack. This derivation creates
# a source tree in a suitable shape to build from -
# today it just patches some scripts but as we add
# support for boards/SoCs we expect the scope of
# "pre-treatment" to grow
tree = stdenvNoCC.mkDerivation { tree = stdenvNoCC.mkDerivation {
name = "spindled-kernel-tree"; name = "spindled-kernel-tree";
src = source; src = source;
@ -22,7 +36,7 @@ let
}; };
in in
{ {
vmlinux = callPackage ./make-vmlinux.nix { vmlinux = callPackage ./vmlinux.nix {
inherit tree; inherit tree;
inherit config; inherit config;
}; };