Skip to content

Commit

Permalink
allow buildIdris output to be used as a dependency in other buildIdri…
Browse files Browse the repository at this point in the history
…s calls more directly
  • Loading branch information
mattpolzin committed Jun 26, 2024
1 parent 5f27842 commit 0ea7c59
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
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

0 comments on commit 0ea7c59

Please sign in to comment.