diff --git a/default.nix b/default.nix index b2a98f0..a1c1f66 100644 --- a/default.nix +++ b/default.nix @@ -16,7 +16,9 @@ let ; }; 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 { outputs = { inherit squashfs kernel; diff --git a/make-kernel.nix b/kernel/default.nix similarity index 61% rename from make-kernel.nix rename to kernel/default.nix index b550996..1f83f84 100644 --- a/make-kernel.nix +++ b/kernel/default.nix @@ -1,12 +1,26 @@ -pkgs: config: +{ + callPackage +, buildPackages +, stdenvNoCC +, fetchFromGitHub + +, config +}: let - inherit (pkgs) callPackage buildPackages stdenvNoCC fetchFromGitHub; source = fetchFromGitHub { owner = "torvalds"; repo = "linux"; rev = "3d7cb6b04c3f3115719235cc6866b10326de34cd"; # v5.19 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 { name = "spindled-kernel-tree"; src = source; @@ -22,7 +36,7 @@ let }; in { - vmlinux = callPackage ./make-vmlinux.nix { + vmlinux = callPackage ./vmlinux.nix { inherit tree; inherit config; }; diff --git a/make-vmlinux.nix b/kernel/vmlinux.nix similarity index 100% rename from make-vmlinux.nix rename to kernel/vmlinux.nix