From 81c3b2003d3d9b1492949773ed69e0c0ddac8316 Mon Sep 17 00:00:00 2001 From: Théo Zimmermann Date: Tue, 3 Jul 2018 13:43:02 +0200 Subject: Refactor default.nix to use optionals. --- default.nix | 46 ++++++++++++++-------------------------------- 1 file changed, 14 insertions(+), 32 deletions(-) (limited to 'default.nix') diff --git a/default.nix b/default.nix index 2bf0409d6..1be274081 100644 --- a/default.nix +++ b/default.nix @@ -42,51 +42,33 @@ stdenv.mkDerivation rec { buildInputs = [ hostname python2 time # coq-makefile timing tools - - ] ++ (with ocamlPackages; [ - ocaml - findlib - camlp5_strict - num - - ]) ++ (if buildIde then [ - - # CoqIDE dependencies - ocamlPackages.lablgtk - - ] else []) ++ (if buildDoc then [ - + ] + ++ (with ocamlPackages; [ ocaml findlib camlp5_strict num ]) + ++ optional buildIde ocamlPackages.lablgtk + ++ optionals buildDoc [ # Sphinx doc dependencies pkgconfig (python3.withPackages (ps: [ ps.sphinx ps.sphinx_rtd_theme ps.pexpect ps.beautifulsoup4 ps.antlr4-python3-runtime ps.sphinxcontrib-bibtex ])) - antlr4 - - ] else []) ++ (if doInstallCheck then - + antlr4 + ] + ++ optionals doInstallCheck ( # Test-suite dependencies # ncurses is required to build an OCaml REPL optional (!versionAtLeast ocaml.version "4.07") ncurses ++ [ ocamlPackages.ounit rsync which ] - - else []) ++ (if lib.inNixShell then [ - ocamlPackages.merlin - ocamlPackages.ocp-indent - ocamlPackages.ocp-index - - # Dependencies of the merging script - jq - curl - git - gnupg - - ] else []); + ) + ++ optionals lib.inNixShell ( + [ jq curl git gnupg ] # Dependencies of the merging script + ++ (with ocamlPackages; [ merlin ocp-indent ocp-index ]) # Dev tools + ); src = if lib.inNixShell then null else with builtins; filterSource - (path: _: !elem (baseNameOf path) [".git" "result" "bin"]) ./.; + (path: _: + !elem (baseNameOf path) [".git" "result" "bin" "_build_ci"]) ./.; prefixKey = "-prefix "; -- cgit v1.2.3