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