about summary refs log tree commit diff
path: root/pkgs/build-support/agda/lib.nix
blob: 63fa6ccddba6b0baeb00769d0fd1c9600d2ec8f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{ lib }:
{
  /* 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"
  */
  interfaceFile = agdaVersion: agdaFile: "_build/" + agdaVersion + "/agda/" + lib.head (builtins.match ''(.*\.)l?agda(\.(md|org|rst|tex|typ))?'' agdaFile) + "agdai";

  /* Takes an arbitrary derivation and says whether it is an agda library package
  *  that is not marked as broken.
  */
  isUnbrokenAgdaPackage = pkg: pkg.isAgdaDerivation or false && !pkg.meta.broken;
}