Skip to content

Commit

Permalink
doc/languages-frameworks/*: add missing languages to code fences
Browse files Browse the repository at this point in the history
convert shell -> ShellSession
  • Loading branch information
SuperSandro2000 committed Apr 5, 2021
1 parent 14edfb4 commit 2c143a4
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 56 deletions.
14 changes: 7 additions & 7 deletions doc/languages-frameworks/agda.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## How to use Agda

Agda can be installed from `agda`:
```
```ShellSession
$ nix-env -iA agda
```

Expand All @@ -15,13 +15,13 @@ To use Agda with libraries, the `agda.withPackages` function can be used. This f

For example, suppose we wanted a version of Agda which has access to the standard library. This can be obtained with the expressions:

```
```nix
agda.withPackages [ agdaPackages.standard-library ]
```

or

```
```nix
agda.withPackages (p: [ p.standard-library ])
```

Expand All @@ -32,7 +32,7 @@ If you want to use a library in your home directory (for instance if it is a dev
Agda will not by default use these libraries. To tell Agda to use the library we have some options:

* Call `agda` with the library flag:
```
```ShellSession
$ agda -l standard-library -i . MyFile.agda
```
* Write a `my-library.agda-lib` file for the project you are working on which may look like:
Expand All @@ -49,7 +49,7 @@ More information can be found in the [official Agda documentation on library man
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.
This can be overridden by a different version of `ghc` as follows:

```
```nix
agda.withPackages {
pkgs = [ ... ];
ghc = haskell.compiler.ghcHEAD;
Expand Down Expand Up @@ -80,12 +80,12 @@ By default, Agda sources are files ending on `.agda`, or literate Agda files end
## Adding Agda packages to Nixpkgs

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:
```
```nix
{ mkDerivation, standard-library, fetchFromGitHub }:
```
and `mkDerivation` should be called instead of `agdaPackages.mkDerivation`. Here is an example skeleton derivation for iowa-stdlib:

```
```nix
mkDerivation {
version = "1.5.0";
pname = "iowa-stdlib";
Expand Down
6 changes: 3 additions & 3 deletions doc/languages-frameworks/dotnet.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

For local development, it's recommended to use nix-shell to create a dotnet environment:

```
```nix
# shell.nix
with import <nixpkgs> {};
Expand All @@ -20,7 +20,7 @@ mkShell {

It's very likely that more than one sdk will be needed on a given project. Dotnet provides several different frameworks (E.g dotnetcore, aspnetcore, etc.) as well as many versions for a given framework. Normally, dotnet is able to fetch a framework and install it relative to the executable. However, this would mean writing to the nix store in nixpkgs, which is read-only. To support the many-sdk use case, one can compose an environment using `dotnetCorePackages.combinePackages`:

```
```nix
with import <nixpkgs> {};
mkShell {
Expand All @@ -37,7 +37,7 @@ mkShell {

This will produce a dotnet installation that has the dotnet 3.1, 3.0, and 2.1 sdk. The first sdk listed will have it's cli utility present in the resulting environment. Example info output:

```
```ShellSesssion
$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.101
Expand Down
18 changes: 9 additions & 9 deletions doc/languages-frameworks/idris.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

The easiest way to get a working idris version is to install the `idris` attribute:

```
```ShellSesssion
$ # On NixOS
$ nix-env -i nixos.idris
$ # On non-NixOS
Expand All @@ -21,38 +21,38 @@ self: super: {

And then:

```
```ShellSesssion
$ # On NixOS
$ nix-env -iA nixos.myIdris
$ # On non-NixOS
$ nix-env -iA nixpkgs.myIdris
```

To see all available Idris packages:
```
```ShellSesssion
$ # On NixOS
$ nix-env -qaPA nixos.idrisPackages
$ # On non-NixOS
$ nix-env -qaPA nixpkgs.idrisPackages
```

Similarly, entering a `nix-shell`:
```
```ShellSesssion
$ nix-shell -p 'idrisPackages.with-packages (with idrisPackages; [ contrib pruviloj ])'
```

## Starting Idris with library support

To have access to these libraries in idris, call it with an argument `-p <library name>` for each library:

```
```ShellSesssion
$ 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`:

```
```ShellSesssion
$ idris --listlibs
00prelude-idx.ibc
pruviloj
Expand Down Expand Up @@ -105,7 +105,7 @@ build-idris-package {

Assuming this file is saved as `yaml.nix`, it's buildable using

```
```ShellSesssion
$ nix-build -E '(import <nixpkgs> {}).idrisPackages.callPackage ./yaml.nix {}'
```

Expand All @@ -121,7 +121,7 @@ with import <nixpkgs> {};

in another file (say `default.nix`) to be able to build it with

```
```ShellSesssion
$ nix-build -A yaml
```

Expand All @@ -133,7 +133,7 @@ Specifically, you can set `idrisBuildOptions`, `idrisTestOptions`, `idrisInstall

For example you could set

```
```nix
build-idris-package {
idrisBuildOptions = [ "--log" "1" "--verbose" ]
Expand Down
8 changes: 4 additions & 4 deletions doc/languages-frameworks/python.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ $ nix-shell -p 'python38.withPackages(ps: with ps; [ numpy toolz ])'
By default `nix-shell` will start a `bash` session with this interpreter in our
`PATH`, so if we then run:

```
```Python console
[nix-shell:~/src/nixpkgs]$ python3
Python 3.8.1 (default, Dec 18 2019, 19:06:26)
[GCC 9.2.0] on linux
Expand All @@ -89,7 +89,7 @@ Type "help", "copyright", "credits" or "license" for more information.
Note that no other modules are in scope, even if they were imperatively
installed into our user environment as a dependency of a Python application:

```
```Python console
>>> import requests
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
Expand Down Expand Up @@ -145,8 +145,8 @@ print(f"The dot product of {a} and {b} is: {np.dot(a, b)}")
Executing this script requires a `python3` that has `numpy`. Using what we learned
in the previous section, we could startup a shell and just run it like so:

```
nix-shell -p 'python38.withPackages(ps: with ps; [ numpy ])' --run 'python3 foo.py'
```ShellSesssion
$ nix-shell -p 'python38.withPackages(ps: with ps; [ numpy ])' --run 'python3 foo.py'
The dot product of [1 2] and [3 4] is: 11
```

Expand Down
6 changes: 3 additions & 3 deletions doc/languages-frameworks/qt.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ supported Qt version.
### Example adding a Qt library {#qt-library-all-packages-nix}

The following represents the contents of `qt5-packages.nix`.
```
```nix
{
# ...
Expand Down Expand Up @@ -133,7 +133,7 @@ to select the Qt 5 version used for the application.
### Example adding a Qt application {#qt-application-all-packages-nix}

The following represents the contents of `qt5-packages.nix`.
```
```nix
{
# ...
Expand All @@ -144,7 +144,7 @@ The following represents the contents of `qt5-packages.nix`.
```

The following represents the contents of `all-packages.nix`.
```
```nix
{
# ...
Expand Down
Loading

0 comments on commit 2c143a4

Please sign in to comment.