-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move agda derivation to a separate file
fix mkAgdaDerivation prettify mkAgdaDerivation
- Loading branch information
Showing
2 changed files
with
33 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{agdaPackages, lib}: args: | ||
with lib.strings; | ||
let | ||
getAttrOrDefault = atr: def: set: | ||
if builtins.hasAttr atr set then builtins.getAttr atr set else def; | ||
in | ||
agdaPackages.mkDerivation (args // | ||
(if # don't override if Everything.agda is present | ||
args ? everythingFile || | ||
# don't override if there's an explicit buildPhase | ||
(getAttrOrDefault "buildPhase" null args != null) || | ||
# do override if either tcFiles or tcDir is present | ||
! (args ? tcFiles || args ? tcDir) | ||
then builtins.trace "not overriding" {} | ||
else | ||
{buildPhase = | ||
let ipaths = getAttrOrDefault "includePaths" [] args; | ||
iarg = concatMapStrings (path: "-i" + path + " ") ipaths; | ||
in if args ? tcFiles | ||
then | ||
'' | ||
runHook preBuild | ||
${concatMapStrings (f: "agda " + iarg + f + ";") args.tcFiles} | ||
runHook postBuild | ||
'' | ||
else | ||
'' | ||
runHook preBuild | ||
find "${args.tcDir}" -type f -name "*.agda" -print0 | xargs -0 -n1 -t ${"agda" + iarg} | ||
runHook postBuild | ||
'' | ||
;})) |