diff options
Diffstat (limited to 'doc/languages-frameworks/idris.section.md')
-rw-r--r-- | doc/languages-frameworks/idris.section.md | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/doc/languages-frameworks/idris.section.md b/doc/languages-frameworks/idris.section.md index f071b9ce178..ffdd706eb0b 100644 --- a/doc/languages-frameworks/idris.section.md +++ b/doc/languages-frameworks/idris.section.md @@ -1,10 +1,10 @@ -# Idris +# Idris {#idris} -## Installing Idris +## Installing Idris {#installing-idris} The easiest way to get a working idris version is to install the `idris` attribute: -``` +```ShellSession $ # On NixOS $ nix-env -i nixos.idris $ # On non-NixOS @@ -21,7 +21,7 @@ self: super: { And then: -``` +```ShellSession $ # On NixOS $ nix-env -iA nixos.myIdris $ # On non-NixOS @@ -29,7 +29,8 @@ $ nix-env -iA nixpkgs.myIdris ``` To see all available Idris packages: -``` + +```ShellSession $ # On NixOS $ nix-env -qaPA nixos.idrisPackages $ # On non-NixOS @@ -37,22 +38,23 @@ $ nix-env -qaPA nixpkgs.idrisPackages ``` Similarly, entering a `nix-shell`: -``` + +```ShellSession $ nix-shell -p 'idrisPackages.with-packages (with idrisPackages; [ contrib pruviloj ])' ``` -## Starting Idris with library support +## Starting Idris with library support {#starting-idris-with-library-support} To have access to these libraries in idris, call it with an argument `-p <library name>` for each library: -``` +```ShellSession $ nix-shell -p 'idrisPackages.with-packages (with idrisPackages; [ contrib pruviloj ])' [nix-shell:~]$ idris -p contrib -p pruviloj ``` A listing of all available packages the Idris binary has access to is available via `--listlibs`: -``` +```ShellSession $ idris --listlibs 00prelude-idx.ibc pruviloj @@ -64,16 +66,16 @@ prelude 00contrib-idx.ibc ``` -## Building an Idris project with Nix +## Building an Idris project with Nix {#building-an-idris-project-with-nix} As an example of how a Nix expression for an Idris package can be created, here is the one for `idrisPackages.yaml`: ```nix -{ build-idris-package +{ lib +, build-idris-package , fetchFromGitHub , contrib , lightyear -, lib }: build-idris-package { name = "yaml"; @@ -94,18 +96,18 @@ build-idris-package { sha256 = "1g4pi0swmg214kndj85hj50ccmckni7piprsxfdzdfhg87s0avw7"; }; - meta = { + meta = with lib; { description = "Idris YAML lib"; homepage = "https://github.com/Heather/Idris.Yaml"; - license = lib.licenses.mit; - maintainers = [ lib.maintainers.brainrape ]; + license = licenses.mit; + maintainers = [ maintainers.brainrape ]; }; } ``` Assuming this file is saved as `yaml.nix`, it's buildable using -``` +```ShellSession $ nix-build -E '(import <nixpkgs> {}).idrisPackages.callPackage ./yaml.nix {}' ``` @@ -121,11 +123,11 @@ with import <nixpkgs> {}; in another file (say `default.nix`) to be able to build it with -``` +```ShellSession $ nix-build -A yaml ``` -## Passing options to `idris` commands +## Passing options to `idris` commands {#passing-options-to-idris-commands} The `build-idris-package` function provides also optional input values to set additional options for the used `idris` commands. @@ -133,7 +135,7 @@ Specifically, you can set `idrisBuildOptions`, `idrisTestOptions`, `idrisInstall For example you could set -``` +```nix build-idris-package { idrisBuildOptions = [ "--log" "1" "--verbose" ] |