+90
-9
doc/languages-frameworks/agda.section.md
+90
-9
doc/languages-frameworks/agda.section.md
···-To use Agda with libraries, the `agda.withPackages` function can be used. This function either takes:* or an attribute set containing a list of packages and a GHC derivation for compilation (see below).For example, suppose we wanted a version of Agda which has access to the standard library. This can be obtained with the expressions:···-If you want to use a library in your home directory (for instance if it is a development version) then typecheck it manually (using `agda.withPackages` if necessary) and then override the `src` attribute of the package to point to your local repository.-Agda will not by default use these libraries. To tell Agda to use the library we have some options:···More information can be found in the [official Agda documentation on library management](https://agda.readthedocs.io/en/v2.6.1/tools/package-system.html).-Agda modules can be compiled with the `--compile` flag. A version of `ghc` with `ieee754` is made available to the Agda program via the `--with-compiler` flag.···* `libraryFile` should be the file name of the `*.agda-lib` file, defaulting to `${libraryName}.agda-lib`.The default build phase for `agdaPackages.mkDerivation` simply runs `agda` on the `Everything.agda` file.If something else is needed to build the package (e.g. `make`) then the `buildPhase` should be overridden.···To add an Agda package to `nixpkgs`, the derivation should be written to `pkgs/development/libraries/agda/${library-name}/` and an entry should be added to `pkgs/top-level/agda-packages.nix`. Here it is called in a scope with access to all other Agda libraries, so the top line of the `default.nix` can look like:-and `mkDerivation` should be called instead of `agdaPackages.mkDerivation`. Here is an example skeleton derivation for iowa-stdlib:
···+Agda is available as the [agda](https://search.nixos.org/packages?channel=unstable&show=agda&from=0&size=30&sort=relevance&query=agda)* or an attribute set containing a list of packages and a GHC derivation for compilation (see below).+* or an attribute set containing a function which returns a list of packages when given the `agdaPackages` attribute set and a GHC derivation for compilation (see below).For example, suppose we wanted a version of Agda which has access to the standard library. This can be obtained with the expressions:···+Agda will not by default use these libraries. To tell Agda to use a library we have some options:···More information can be found in the [official Agda documentation on library management](https://agda.readthedocs.io/en/v2.6.1/tools/package-system.html).+Agda modules can be compiled using the GHC backend with the `--compile` flag. A version of `ghc` with `ieee754` is made available to the Agda program via the `--with-compiler` flag.···* `libraryName` should be the name that appears in the `*.agda-lib` file, defaulting to `pname`.* `libraryFile` should be the file name of the `*.agda-lib` file, defaulting to `${libraryName}.agda-lib`.The default build phase for `agdaPackages.mkDerivation` simply runs `agda` on the `Everything.agda` file.If something else is needed to build the package (e.g. `make`) then the `buildPhase` should be overridden.···To add an Agda package to `nixpkgs`, the derivation should be written to `pkgs/development/libraries/agda/${library-name}/` and an entry should be added to `pkgs/top-level/agda-packages.nix`. Here it is called in a scope with access to all other Agda libraries, so the top line of the `default.nix` can look like:+Note that the derivation function is called with `mkDerivation` set to `agdaPackages.mkDerivation`, therefore you+could use a similar set as in your `default.nix` from [Writing Agda Packages](#writing-agda-packages) with