aboutsummaryrefslogtreecommitdiffhomepage
path: root/default.nix
blob: 6d50fb4d9c4fb366e8181f5e74c0f4129107948c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# How to use?

# If you have Nix installed, you can get in an environment with everything
# needed to compile Coq and CoqIDE by running:
# $ nix-shell
# at the root of the Coq repository.

# How to tweak default arguments?

# nix-shell supports the --arg option (see Nix doc) that allows you for
# instance to do this:
# $ nix-shell --arg ocamlPackages "(import <nixpkgs> {}).ocamlPackages_latest" --arg buildIde false

# You can also compile Coq and "install" it by running:
# $ make clean # (only needed if you have left-over compilation files)
# $ nix-build
# at the root of the Coq repository.
# nix-build also supports the --arg option, so you will be able to do:
# $ nix-build --arg doCheck false
# if you want to speed up things by not running the test-suite.
# Once the build is finished, you will find, in the current directory,
# a symlink to where Coq was installed.

{ pkgs ? (import <nixpkgs> {}), ocamlPackages ? pkgs.ocamlPackages,
  buildIde ? true, doCheck ? true }:

with pkgs;

stdenv.mkDerivation rec {

  name = "coq";

  buildInputs = (with ocamlPackages; [

    # Coq dependencies
    ocaml
    findlib
    camlp5_strict

  ]) ++ (if buildIde then [

    # CoqIDE dependencies
    ocamlPackages.lablgtk

  ] else []) ++ (if doCheck then [

    # Test-suite dependencies
    ncurses
    python
    rsync
    which

  ] else []);

  src =
    if lib.inNixShell then null
    else
      with builtins; filterSource
        (path: _: !elem (baseNameOf path) [".git" "result" "bin"]) ./.;

  prefixKey = "-prefix ";

  inherit doCheck;

}