From 11ed3dc731280e716d4174289589cf78734b6bde Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Wed, 18 Sep 2024 14:48:17 +0200 Subject: [PATCH] Save GC roots using all drv attributes --- flake.nix | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/flake.nix b/flake.nix index 77ba7a2..9e50405 100644 --- a/flake.nix +++ b/flake.nix @@ -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 =