agdaPackages.mkDerivation: don't install Everything module

The Everthing module is not part of a library and should therefore
not be copied to the nix store.

This is particularly bad, if the Everything module is defined in
an agda library included directory, e.g. consider an agda-lib with

    include: .

and Everything.agda in the project root (.), in which case the
Everything module would become part of the library.
If multiple such projects are in the dependency tree, the Everything
module becomes ambiguous and the build would fail.
This commit is contained in:
Alexander Ben Nasrallah 2021-01-18 20:01:31 +01:00
parent b929be75dc
commit 226299e1a2
No known key found for this signature in database
GPG key ID: DF6D22A22FA2D5A8
4 changed files with 20 additions and 1 deletions

View file

@ -23,6 +23,13 @@ in
};
testScript = ''
assert (
"${pkgs.agdaPackages.lib.interfaceFile "Everything.agda"}" == "Everything.agdai"
), "wrong interface file for Everything.agda"
assert (
"${pkgs.agdaPackages.lib.interfaceFile "tmp/Everything.agda.md"}" == "tmp/Everything.agdai"
), "wrong interface file for tmp/Everything.agda.md"
# Minimal script that typechecks
machine.succeed("touch TestEmpty.agda")
machine.succeed("agda TestEmpty.agda")

View file

@ -70,7 +70,7 @@ let
installPhase = if installPhase != null then installPhase else ''
runHook preInstall
mkdir -p $out
find \( ${concatMapStringsSep " -or " (p: "-name '*.${p}'") (extensions ++ extraExtensions)} \) -exec cp -p --parents -t "$out" {} +
find -not \( -path ${everythingFile} -or -path ${lib.interfaceFile everythingFile} \) -and \( ${concatMapStringsSep " -or " (p: "-name '*.${p}'") (extensions ++ extraExtensions)} \) -exec cp -p --parents -t "$out" {} +
runHook postInstall
'';
};

View file

@ -0,0 +1,10 @@
{ lib }:
{
/* Returns the Agda interface file to a given Agda file.
*
* Examples:
* interfaceFile "Everything.agda" == "Everything.agdai"
* interfaceFile "src/Everything.lagda.tex" == "src/Everything.agdai"
*/
interfaceFile = agdaFile: lib.head (builtins.match ''(.*\.)l?agda(\.(md|org|rst|tex))?'' agdaFile) + "agdai";
}

View file

@ -11,6 +11,8 @@ let
in {
inherit mkDerivation;
lib = lib.extend (final: prev: import ../build-support/agda/lib.nix { lib = prev; });
agda = withPackages [] // { inherit withPackages; };
standard-library = callPackage ../development/libraries/agda/standard-library {