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

[nix] allow buildIdris output to be used as a dependency in other buildIdris calls more directly #3333

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion nix/buildIdris.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,24 @@
, ... }@attrs:

let
# loop over idrisLibraries and normalize them by turning any that are
# direct outputs of the buildIdris function into the `.library {}`
# property.
idrisLibraryLibs = map (idrisLib:
if lib.isDerivation idrisLib
then idrisLib
else if builtins.isFunction idrisLib
then idrisLib {}
else if (builtins.isAttrs idrisLib && idrisLib ? "library")
then idrisLib.library {}
else throw "Found an Idris2 library dependency that was not the result of the buildIdris function"
) idrisLibraries;

propagate = libs: lib.unique (lib.concatMap (nextLib: [nextLib] ++ nextLib.propagatedIdrisLibraries) libs);
ipkgFileName = ipkgName + ".ipkg";
idrName = "idris2-${idris2Version}";
libSuffix = "lib/${idrName}";
propagatedIdrisLibraries = propagate idrisLibraries;
propagatedIdrisLibraries = propagate idrisLibraryLibs;
libDirs =
lib.strings.makeSearchPath libSuffix propagatedIdrisLibraries;
drvAttrs = builtins.removeAttrs attrs [
Expand Down
Loading