Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
c47a8581
Commit
c47a8581
authored
3 years ago
by
Virgile Prevosto
Browse files
Options
Downloads
Patches
Plain Diff
[nix] migrating to opam2nix v1: allow derivation to add custom opam packages
parent
d1905a79
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nix/default.nix
+36
-32
36 additions, 32 deletions
nix/default.nix
with
36 additions
and
32 deletions
nix/default.nix
+
36
−
32
View file @
c47a8581
# paramaterised derivation with dependencies injected (callPackage style)
{
pkgs
,
stdenv
,
src
?
../.
,
opam2nix
,
ocaml
_version
?
"ocaml-ng.ocamlPackages_4_08.ocaml"
,
plugins
?
{
}
}:
{
pkgs
,
stdenv
,
src
?
../.
,
opam2nix
,
ocaml
?
"ocaml-ng.ocamlPackages_4_08.ocaml"
,
plugins
?
{
}
}:
let
mk_buildInputs
=
{
opamPackages
?
[],
nixPackages
?
[]
}
:
[
pkgs
.
gnugrep
pkgs
.
gnused
pkgs
.
autoconf
pkgs
.
gnumake
pkgs
.
gcc
pkgs
.
ncurses
pkgs
.
time
pkgs
.
python3
pkgs
.
perl
pkgs
.
file
pkgs
.
which
pkgs
.
dos2unix
]
++
nixPackages
++
opam2nix
.
build
{
specs
=
opam2nix
.
toSpecs
([
"ocamlfind"
"zarith"
"ocamlgraph"
"yojson"
"zmq"
"ppx_deriving"
"ppx_deriving_yojson"
{
name
=
"coq"
;
constraint
=
"=8.12.0"
;
}
{
name
=
"alt-ergo"
;
constraint
=
"=2.2.0"
;
}
{
name
=
"why3"
;
constraint
=
"=1.4.0"
;
}
{
name
=
"why3-coq"
;
constraint
=
"=1.4.0"
;
}
]
++
opamPackages
);
ocamlAttr
=
ocaml_version
;
};
let
opam-selection
=
{
inherit
ocaml
;
selection
=
./opam-selection.nix
;
};
mk_opam_derivations
=
packages
:
opam2nix
.
resolve
opam-selection
packages
;
opam_packages
=
[
"ocamlfind"
"zarith"
"ocamlgraph"
"yojson"
"zmq"
"ppx_deriving"
"ppx_deriving_yojson"
"coq=8.12.0"
"alt-ergo=2.2.0"
"why3=1.4.0"
"why3-coq=1.4.0"
];
mk_buildInputs
=
{
nixPackages
?
[]
}
:
[
pkgs
.
gnugrep
pkgs
.
gnused
pkgs
.
autoconf
pkgs
.
gnumake
pkgs
.
gcc
pkgs
.
ncurses
pkgs
.
time
pkgs
.
python3
pkgs
.
perl
pkgs
.
file
pkgs
.
which
pkgs
.
dos2unix
]
++
nixPackages
++
opam2nix
.
buildInputs
opam-selection
;
# Extends the call to stdenv.mkDerivation with parameters common for all
# frama-c derivations
mk_deriv
=
args
:
let
my_opam_packages
=
if
args
?
opam_packages
then
opam_packages
++
args
.
opam_packages
else
opam_packages
;
in
stdenv
.
mkDerivation
({
# Disable Nix's GCC hardening
hardeningDisable
=
[
"all"
];
}
//
args
);
}
//
args
)
//
{
gen-opam-selection
=
mk_opam_derivations
my_opam_packages
;
}
;
in
pkgs
.
lib
.
makeExtensible
(
self
:
{
inherit
src
mk_buildInputs
;
inherit
src
mk_buildInputs
opam_packages
;
gen-opam-selection
=
mk_opam_derivations
self
.
opam_packages
;
buildInputs
=
mk_buildInputs
{};
installed
=
self
.
main
.
out
;
main
=
mk_deriv
{
...
...
@@ -74,13 +83,9 @@ pkgs.lib.makeExtensible
lint
=
mk_deriv
{
name
=
"frama-c-lint"
;
src
=
self
.
src
;
opam_packages
=
[
"ocp-indent=1.7.0"
"headache=1.05"
];
buildInputs
=
(
self
.
mk_buildInputs
{
nixPackages
=
[
pkgs
.
bc
];
opamPackages
=
[
{
name
=
"ocp-indent"
;
constraint
=
"=1.7.0"
;
}
{
name
=
"headache"
;
constraint
=
"=1.05"
;
}
];}
);
self
.
mk_buildInputs
{
nixPackages
=
[
pkgs
.
bc
];
};
outputs
=
[
"out"
];
postPatch
=
''
patchShebangs .
...
...
@@ -125,11 +130,8 @@ pkgs.lib.makeExtensible
build-distrib-tarball
=
mk_deriv
{
name
=
"frama-c-build-distrib-tarball"
;
src
=
self
.
src
;
buildInputs
=
(
self
.
mk_buildInputs
{
opamPackages
=
[
{
name
=
"headache"
;
constraint
=
"=1.05"
;
}
];}
);
buildInputs
=
self
.
buildInputs
;
opam_packages
=
[
"headache=1.05"
];
outputs
=
[
"out"
];
postPatch
=
''
patchShebangs .
...
...
@@ -152,6 +154,7 @@ pkgs.lib.makeExtensible
build-from-distrib-tarball
=
mk_deriv
{
name
=
"frama-c-build-from-distrib-tarball"
;
buildInputs
=
self
.
buildInputs
;
opam_packages
=
self
.
build-distrib-tarball
.
opam_packages
;
src
=
self
.
build-distrib-tarball
.
out
;
outputs
=
[
"out"
];
configurePhase
=
''
...
...
@@ -248,12 +251,13 @@ pkgs.lib.makeExtensible
internal
=
mk_deriv
{
name
=
"frama-c-internal"
;
src
=
self
.
src
;
buildInputs
=
(
self
.
mk_buildInputs
{
opamPackages
=
[
"xml-light"
];
}
)
++
[
pkgs
.
getopt
pkgs
.
libxslt
pkgs
.
libxml2
pkgs
.
autoPatchelfHook
pkgs
.
swiProlog
stdenv
.
cc
.
cc
.
lib
];
opam_packages
=
[
"xml-light"
];
buildInputs
=
self
.
mk_buildInputs
{
nixPackages
=
[
pkgs
.
getopt
pkgs
.
libxslt
pkgs
.
libxml2
pkgs
.
autoPatchelfHook
pkgs
.
swiProlog
stdenv
.
cc
.
cc
.
lib
];
};
counter_examples_src
=
plugins
.
counter-examples
.
src
;
genassigns_src
=
plugins
.
genassigns
.
src
;
frama_clang_src
=
plugins
.
frama-clang
.
src
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment