Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib }:
2{
3 /*
4 Returns the Agda interface file to a given Agda file.
5 *
6 * The resulting path may not be normalized.
7 *
8 * Examples:
9 * interfaceFile pkgs.agda.version "./Foo.agda" == "_build/AGDA_VERSION/agda/./Foo.agdai"
10 * interfaceFile pkgs.agda.version "src/Foo.lagda.tex" == "_build/AGDA_VERSION/agda/src/Foo.agdai"
11 */
12 interfaceFile =
13 agdaVersion: agdaFile:
14 "_build/"
15 + agdaVersion
16 + "/agda/"
17 + lib.head (builtins.match ''(.*\.)l?agda(\.(md|org|rst|tex|typ))?'' agdaFile)
18 + "agdai";
19
20 /*
21 Takes an arbitrary derivation and says whether it is an agda library package
22 * that is not marked as broken.
23 */
24 isUnbrokenAgdaPackage = pkg: pkg.isAgdaDerivation or false && !pkg.meta.broken;
25}