core/pkgs/build-support/agda/lib.nix

26 lines
771 B
Nix
Raw Normal View History

2024-05-02 00:46:19 +00:00
{ lib }:
{
2024-06-30 08:12:46 +00:00
/*
Returns the Agda interface file to a given Agda file.
*
* The resulting path may not be normalized.
*
* Examples:
* interfaceFile pkgs.agda.version "./Everything.agda" == "_build/2.6.4.3/agda/./Everything.agdai"
* interfaceFile pkgs.agda.version "src/Everything.lagda.tex" == "_build/2.6.4.3/agda/src/Everything.agdai"
2024-05-02 00:46:19 +00:00
*/
2024-06-30 08:12:46 +00:00
interfaceFile =
agdaVersion: agdaFile:
"_build/"
+ agdaVersion
+ "/agda/"
+ lib.head (builtins.match ''(.*\.)l?agda(\.(md|org|rst|tex|typ))?'' agdaFile)
+ "agdai";
2024-05-02 00:46:19 +00:00
2024-06-30 08:12:46 +00:00
/*
Takes an arbitrary derivation and says whether it is an agda library package
* that is not marked as broken.
2024-05-02 00:46:19 +00:00
*/
isUnbrokenAgdaPackage = pkg: pkg.isAgdaDerivation or false && !pkg.meta.broken;
}