Only save kernel and opensbi build inputs

This commit is contained in:
Rodrigo Arias 2024-09-18 14:07:49 +02:00
parent 9daa796b10
commit 877428c2fe

View File

@ -8,6 +8,16 @@
let
system = "x86_64-linux";
nixosSystem = import (nixpkgs + "/nixos/lib/eval-config.nix");
buildRoots = { pkgs, save }:
let
buildInner = { package, attr }:
if (attr == "")
then pkgs.linkFarmFromDrvs "${package.name}" [ package ]
else pkgs.linkFarmFromDrvs "${package.name}.${attr}" package.${attr};
in pkgs.linkFarmFromDrvs "top-level" (pkgs.lib.mapCartesianProduct buildInner {
package = save;
attr = [ "" "buildInputs" "nativeBuildInputs" ];
});
in {
#overlay = import ./overlay.nix;
nixosConfigurations = {
@ -100,17 +110,7 @@
nixosconf = self.nixosConfigurations.lagarto-ox;
syspkgs = nixosconf.pkgs;
build = nixosconf.config.system.build;
buildRoots = savePkgs:
let
pkgs = syspkgs;
buildInner = { package, attr }: pkgs.linkFarmFromDrvs "${package.name}.${attr}" package.${attr};
in pkgs.linkFarmFromDrvs "top-level" (pkgs.lib.mapCartesianProduct buildInner {
package = savePkgs;
attr = [ "buildInputs" "nativeBuildInputs" ];
});
in syspkgs.mkShell {
in syspkgs.mkShell rec {
pname = "lagarto-ox-shell";
TOPLEVEL = build.toplevel;
OPENSBI = syspkgs.opensbi;
@ -120,7 +120,7 @@
UBOOT_ENV = syspkgs.uboot-env;
BITSTREAM = syspkgs.bitstream;
BOOTROM = syspkgs.bootrom;
GCROOT = buildRoots [ build.toplevel build.kernel ];
GCROOT = buildRoots { pkgs = syspkgs; save = [ KERNEL OPENSBI ]; };
shellHook = ''
echo "Here are the current system pieces:"
echo " TOPLEVEL = $TOPLEVEL"
@ -136,9 +136,13 @@
};
devShells.x86_64-linux.lagarto-ox-rd =
self.outputs.devShells.x86_64-linux.lagarto-ox.overrideAttrs (old:{
let
nixosconf = self.nixosConfigurations.lagarto-ox;
syspkgs = nixosconf.pkgs;
in self.outputs.devShells.x86_64-linux.lagarto-ox.overrideAttrs (old:{
TOPLEVEL = "";
ROOTFS = "";
GCROOT = buildRoots { pkgs = syspkgs; save = [ old.OPENSBI ]; };
});
devShells.x86_64-linux.default =