idris2Packages.buildIdris: More lenient and ergonomic dependency inputs
This commit is contained in:
@@ -18,11 +18,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-${idris2.version}";
|
||||
libSuffix = "lib/${idrName}";
|
||||
propagatedIdrisLibraries = propagate idrisLibraries;
|
||||
propagatedIdrisLibraries = propagate idrisLibraryLibs;
|
||||
libDirs =
|
||||
(lib.makeSearchPath libSuffix propagatedIdrisLibraries) +
|
||||
":${idris2}/${idrName}";
|
||||
|
||||
Reference in New Issue
Block a user