Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(hare): ensure HAREPATH to be always set #328

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions extra/language/hare.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ let
cfg = config.language.hare;
strOrPackage = import ../../nix/strOrPackage.nix { inherit lib pkgs; };
makeHareFullPath =
thirdParty:
userHareLibs:
let
allHareThirdPartyPkgs = builtins.attrValues (pkgs.hareThirdParty.packages pkgs);
isPropagatedLib = drv: builtins.any (x: drv == x) allHareThirdPartyPkgs;
pkgsPropagatedBuildInputs = builtins.foldl' (acc: e: acc ++ e.propagatedBuildInputs) [ ] thirdParty;
propagatedLibs = builtins.filter isPropagatedLib pkgsPropagatedBuildInputs;
allHareThirdPartyLibs = builtins.attrValues (pkgs.hareThirdParty.packages pkgs);
propagatedLibs = lib.unique (
builtins.foldl' (
acc: userLib: acc ++ (lib.intersectLists userLib.propagatedBuildInputs allHareThirdPartyLibs)
) [ ] userHareLibs
);
in
lib.makeSearchPath "src/hare/third-party" (thirdParty ++ propagatedLibs);
lib.makeSearchPath "src/hare/third-party" (userHareLibs ++ propagatedLibs);
in
with lib;
{
Expand All @@ -42,10 +44,10 @@ with lib;

config = {
env = [
(mkIf (cfg.thirdPartyLibs != [ ] || cfg.vendoredLibs != [ ]) {
{
name = "HAREPATH";
value = lib.makeSearchPath "src/hare/stdlib" [ cfg.package ];
})
}
(mkIf (cfg.thirdPartyLibs != [ ]) {
name = "HAREPATH";
prefix = makeHareFullPath cfg.thirdPartyLibs;
Expand Down
Loading