1 { lib, stdenv, fetchurl, fetchpatch, makeWrapper, writeText
3 , ocamlPackages, ltl2ba, coq, why3
4 , gdk-pixbuf, wrapGAppsHook
8 mkocamlpath = p: "${p}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib";
9 runtimeDeps = with ocamlPackages; [
35 ocamlpath = lib.concatMapStringsSep ":" mkocamlpath runtimeDeps;
38 stdenv.mkDerivation rec {
44 url = "https://frama-c.com/download/frama-c-${version}-${slang}.tar.gz";
45 hash = "sha256-AiC8dDt9okaM65JvMx7cfd+qfGA7pHli3j4zyOHj9ZM=";
49 substituteInPlace src/dune --replace " bytes " " "
52 postConfigure = "patchShebangs src/plugins/eva/gen-api.sh";
56 nativeBuildInputs = [ wrapGAppsHook ] ++ (with ocamlPackages; [ ocaml findlib dune_3 menhir ]);
58 buildInputs = with ocamlPackages; [
59 dune-site dune-configurator
60 ltl2ba ocamlgraph yojson menhirLib camlzip
61 lablgtk3 lablgtk3-sourceview3 coq graphviz zarith apron why3 mlgmpidl doxygen
62 ppx_deriving ppx_import ppx_deriving_yaml ppx_deriving_yojson
69 dune build -j$NIX_BUILD_CORES --release @install
73 installFlags = [ "PREFIX=$(out)" ];
76 gappsWrapperArgs+=(--prefix OCAMLPATH ':' ${ocamlpath}:$out/lib/)
79 # Allow loading of external Frama-C plugins
80 setupHook = writeText "setupHook.sh" ''
82 if test -d "''$1/lib/frama-c/plugins"; then
83 export FRAMAC_PLUGIN="''${FRAMAC_PLUGIN-}''${FRAMAC_PLUGIN:+:}''$1/lib/frama-c/plugins"
84 export OCAMLPATH="''${OCAMLPATH-}''${OCAMLPATH:+:}''$1/lib/frama-c/plugins"
87 if test -d "''$1/lib/frama-c"; then
88 export OCAMLPATH="''${OCAMLPATH-}''${OCAMLPATH:+:}''$1/lib/frama-c"
91 if test -d "''$1/share/frama-c/"; then
92 export FRAMAC_EXTRA_SHARE="''${FRAMAC_EXTRA_SHARE-}''${FRAMAC_EXTRA_SHARE:+:}''$1/share/frama-c"
97 addEnvHooks "$targetOffset" addFramaCPath
102 description = "An extensible and collaborative platform dedicated to source-code analysis of C software";
103 homepage = "http://frama-c.com/";
104 license = lib.licenses.lgpl21;
105 maintainers = with lib.maintainers; [ thoughtpolice amiddelk ];
106 platforms = lib.platforms.unix;