Save GC roots using all drv attributes

This commit is contained in:
Rodrigo Arias 2024-09-18 14:48:17 +02:00
parent 71d124815f
commit 11ed3dc731

View File

@ -8,16 +8,8 @@
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" ];
});
mkRoots = pkgs: list: pkgs.writeText "gcroots.json"
(builtins.toJSON (map (x: { drv = x; attrs = x.drvAttrs; }) list));
in {
#overlay = import ./overlay.nix;
nixosConfigurations = {
@ -120,7 +112,7 @@
UBOOT_ENV = syspkgs.uboot-env;
BITSTREAM = syspkgs.bitstream;
BOOTROM = syspkgs.bootrom;
GCROOT = buildRoots { pkgs = syspkgs; save = [ syspkgs.stdenv KERNEL OPENSBI ]; };
GCROOT = mkRoots syspkgs [ syspkgs.stdenv KERNEL OPENSBI ];
shellHook = ''
echo "Here are the current system pieces:"
echo " TOPLEVEL = $TOPLEVEL"
@ -142,7 +134,7 @@
in self.outputs.devShells.x86_64-linux.lagarto-ox.overrideAttrs (old:{
TOPLEVEL = "";
ROOTFS = "";
GCROOT = buildRoots { pkgs = syspkgs; save = [ syspkgs.stdenv old.OPENSBI ]; };
GCROOT = mkRoots syspkgs [ syspkgs.stdenv old.OPENSBI ];
});
devShells.x86_64-linux.default =