From 52f29c31807beea0be30a0dccac7d0e49a5b92f5 Mon Sep 17 00:00:00 2001 From: Quinn Unger Date: Mon, 13 Jul 2026 16:11:21 +0100 Subject: [PATCH] expose default coreSet under fusesoc.lib.cores (#20) --- flake.nix | 13 +++++++------ lib/fusesocLib.nix | 9 ++++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/flake.nix b/flake.nix index cb60285..e6f71fe 100644 --- a/flake.nix +++ b/flake.nix @@ -38,7 +38,6 @@ pkgs = nixpkgs.legacyPackages.${system}; inherit (self.packages.${system}) fusesoc; coreList = pkgs.callPackage ./cores/fusesoc-cores.nix { fusesocLib = fusesoc.lib; }; - coreSet = fusesoc.lib.mkCoreSet coreList; in { packages = { @@ -59,7 +58,9 @@ # hack to get around `nix flake check` complaining about fusesocLib not being a derivation. _: prev: { passthru = prev.passthru // { - lib = pkgs.callPackage ./lib/fusesocLib.nix { fusesoc = pkg; }; + lib = (pkgs.callPackage ./lib/fusesocLib.nix { fusesoc = pkg; }) // { + cores = fusesoc.lib.mkCoreSet coreList; + }; }; } ); @@ -70,12 +71,12 @@ }; }; devShells.default = pkgs.mkShell { - packages = [ (fusesoc.lib.wrapFusesoc coreList) ]; + packages = [ (with fusesoc.lib; wrapFusesoc cores) ]; }; checks = let - noVendor = coreSet."".""; - inherit (coreSet) bespoke-silicon-group; + noVendor = fusesoc.lib.cores."".""; + inherit (fusesoc.lib.cores) bespoke-silicon-group; in { inherit (noVendor) @@ -92,7 +93,7 @@ bsg-basejump_stl-hard = bespoke-silicon-group.basejump_stl.hard; bsg-basejump_stl-nonsynth = bespoke-silicon-group.basejump_stl.nonsynth; bsg-basejump_stl-rtl = bespoke-silicon-group.basejump_stl.rtl; - bsg-external-hardfloat = coreSet.bsg-external.hardfloat."0.0.1"; # original corename is mangled like this + bsg-external-hardfloat = fusesoc.lib.cores.bsg-external.hardfloat."0.0.1"; # original corename is mangled like this jtag_vpi_0-r3 = noVendor.jtag_vpi."0-r3"; jtag_vpi_0-r4 = noVendor.jtag_vpi."0-r4"; jtag_vpi_0-r5 = noVendor.jtag_vpi."0-r5"; diff --git a/lib/fusesocLib.nix b/lib/fusesocLib.nix index f2aa354..96db7c1 100644 --- a/lib/fusesocLib.nix +++ b/lib/fusesocLib.nix @@ -232,6 +232,13 @@ rec { mkCoreSet = extendCoreSet { }; + toCoreList = + let + unwrap = builtins.concatMap (x: lib.attrsToList x.value); + in + coreSet: + builtins.concatMap (x: x.value.list or [ x.value ]) (unwrap (unwrap (lib.attrsToList coreSet))); + wrapFusesoc = let sanitize = @@ -256,7 +263,7 @@ rec { in sources: writeScriptBin "fusesoc" '' - export FUSESOC_CONFIG=${mkConf sources} + export FUSESOC_CONFIG=${mkConf (if builtins.isList sources then sources else (toCoreList sources))} exec ${fusesoc}/bin/fusesoc $@ ''; -- 2.51.2