Skip to content
Snippets Groups Projects
Commit 81f3abaf authored by Virgile Prevosto's avatar Virgile Prevosto
Browse files

make nix attributes in default.nix extensible

parent 2fc09908
No related branches found
No related tags found
No related merge requests found
...@@ -25,13 +25,15 @@ let mk_buildInputs = { opamPackages ? [], nixPackages ? [] } : ...@@ -25,13 +25,15 @@ let mk_buildInputs = { opamPackages ? [], nixPackages ? [] } :
} // args); } // args);
in in
rec { pkgs.lib.makeExtensible
(self: {
inherit src mk_buildInputs; inherit src mk_buildInputs;
buildInputs = mk_buildInputs {}; buildInputs = mk_buildInputs {};
installed = main.out; installed = self.main.out;
main = mk_deriv { main = mk_deriv {
name = "frama-c"; name = "frama-c";
inherit src buildInputs; src = self.src;
buildInputs =self.buildInputs;
outputs = [ "out" "build_dir" ]; outputs = [ "out" "build_dir" ];
postPatch = '' postPatch = ''
patchShebangs . patchShebangs .
...@@ -73,9 +75,9 @@ rec { ...@@ -73,9 +75,9 @@ rec {
lint = mk_deriv { lint = mk_deriv {
name = "frama-c-lint"; name = "frama-c-lint";
inherit src; src = self.src;
buildInputs = buildInputs =
(mk_buildInputs { (self.mk_buildInputs {
nixPackages = [ pkgs.bc ]; nixPackages = [ pkgs.bc ];
opamPackages = [ opamPackages = [
{ name = "ocp-indent"; constraint = "=1.7.0"; } { name = "ocp-indent"; constraint = "=1.7.0"; }
...@@ -102,9 +104,9 @@ rec { ...@@ -102,9 +104,9 @@ rec {
tests = mk_deriv { tests = mk_deriv {
name = "frama-c-test"; name = "frama-c-test";
inherit buildInputs; buildInputs = self.buildInputs;
build_dir = main.build_dir; build_dir = self.main.build_dir;
src = main.build_dir + "/dir.tar"; src = self.main.build_dir + "/dir.tar";
sourceRoot = "."; sourceRoot = ".";
postUnpack = '' postUnpack = ''
find . \( -name "Makefile*" -or -name ".depend" -o -name "ptests_config" -o -name "config.status" \) -exec bash -c "t=\$(stat -c %y \"\$0\"); sed -i -e \"s&$(cat $build_dir/old_pwd)&$(pwd)&g\" \"\$0\"; touch -d \"\$t\" \"\$0\"" {} \; find . \( -name "Makefile*" -or -name ".depend" -o -name "ptests_config" -o -name "config.status" \) -exec bash -c "t=\$(stat -c %y \"\$0\"); sed -i -e \"s&$(cat $build_dir/old_pwd)&$(pwd)&g\" \"\$0\"; touch -d \"\$t\" \"\$0\"" {} \;
...@@ -124,9 +126,9 @@ rec { ...@@ -124,9 +126,9 @@ rec {
build-distrib-tarball = mk_deriv { build-distrib-tarball = mk_deriv {
name = "frama-c-build-distrib-tarball"; name = "frama-c-build-distrib-tarball";
inherit src; src = self.src;
buildInputs = buildInputs =
(mk_buildInputs { (self.mk_buildInputs {
opamPackages = [ opamPackages = [
{ name = "headache"; constraint = "=1.05"; } { name = "headache"; constraint = "=1.05"; }
];} ); ];} );
...@@ -151,8 +153,8 @@ rec { ...@@ -151,8 +153,8 @@ rec {
build-from-distrib-tarball = mk_deriv { build-from-distrib-tarball = mk_deriv {
name = "frama-c-build-from-distrib-tarball"; name = "frama-c-build-from-distrib-tarball";
inherit buildInputs; buildInputs = self.buildInputs;
src = build-distrib-tarball.out ; src = self.build-distrib-tarball.out ;
outputs = [ "out" ]; outputs = [ "out" ];
configurePhase = '' configurePhase = ''
unset CC unset CC
...@@ -169,9 +171,9 @@ rec { ...@@ -169,9 +171,9 @@ rec {
wp-qualif = mk_deriv { wp-qualif = mk_deriv {
name = "frama-c-wp-qualif"; name = "frama-c-wp-qualif";
buildInputs = mk_buildInputs { }; buildInputs = self.mk_buildInputs { };
build_dir = main.build_dir; build_dir = self.main.build_dir;
src = main.build_dir + "/dir.tar"; src = self.main.build_dir + "/dir.tar";
sourceRoot = "."; sourceRoot = ".";
postUnpack = '' postUnpack = ''
find . \( -name "Makefile*" -or -name ".depend" -o -name "ptests_config" -o -name "config.status" \) -exec bash -c "t=\$(stat -c %y \"\$0\"); sed -i -e \"s&$(cat $build_dir/old_pwd)&$(pwd)&g\" \"\$0\"; touch -d \"\$t\" \"\$0\"" {} \; find . \( -name "Makefile*" -or -name ".depend" -o -name "ptests_config" -o -name "config.status" \) -exec bash -c "t=\$(stat -c %y \"\$0\"); sed -i -e \"s&$(cat $build_dir/old_pwd)&$(pwd)&g\" \"\$0\"; touch -d \"\$t\" \"\$0\"" {} \;
...@@ -197,9 +199,9 @@ rec { ...@@ -197,9 +199,9 @@ rec {
aorai-prove = mk_deriv { aorai-prove = mk_deriv {
name = "frama-c-aorai-prove"; name = "frama-c-aorai-prove";
buildInputs = mk_buildInputs { }; buildInputs = self.mk_buildInputs { };
build_dir = main.build_dir; build_dir = self.main.build_dir;
src = main.build_dir + "/dir.tar"; src = self.main.build_dir + "/dir.tar";
sourceRoot = "."; sourceRoot = ".";
postUnpack = '' postUnpack = ''
find . \( -name "Makefile*" -or -name ".depend" -o -name "ptests_config" -o -name "test_config*" -o -name "config.status" \) -exec bash -c "t=\$(stat -c %y \"\$0\"); sed -i -e \"s&$(cat $build_dir/old_pwd)&$(pwd)&g\" \"\$0\"; touch -d \"\$t\" \"\$0\"" {} \; find . \( -name "Makefile*" -or -name ".depend" -o -name "ptests_config" -o -name "test_config*" -o -name "config.status" \) -exec bash -c "t=\$(stat -c %y \"\$0\"); sed -i -e \"s&$(cat $build_dir/old_pwd)&$(pwd)&g\" \"\$0\"; touch -d \"\$t\" \"\$0\"" {} \;
...@@ -225,9 +227,9 @@ rec { ...@@ -225,9 +227,9 @@ rec {
e-acsl-tests-dev = mk_deriv { e-acsl-tests-dev = mk_deriv {
name = "frama-c-e-acsl-tests-dev"; name = "frama-c-e-acsl-tests-dev";
buildInputs = mk_buildInputs { nixPackages = [ pkgs.gmp pkgs.getopt ]; }; buildInputs = self.mk_buildInputs { nixPackages = [ pkgs.gmp pkgs.getopt ]; };
build_dir = main.build_dir; build_dir = self.main.build_dir;
src = main.build_dir + "/dir.tar"; src = self.main.build_dir + "/dir.tar";
sourceRoot = "."; sourceRoot = ".";
postUnpack = '' postUnpack = ''
find . \( -name "Makefile*" -or -name ".depend" -o -name "ptests_config" -o -name "config.status" \) -exec bash -c "t=\$(stat -c %y \"\$0\"); sed -i -e \"s&$(cat $build_dir/old_pwd)&$(pwd)&g\" \"\$0\"; touch -d \"\$t\" \"\$0\"" {} \; find . \( -name "Makefile*" -or -name ".depend" -o -name "ptests_config" -o -name "config.status" \) -exec bash -c "t=\$(stat -c %y \"\$0\"); sed -i -e \"s&$(cat $build_dir/old_pwd)&$(pwd)&g\" \"\$0\"; touch -d \"\$t\" \"\$0\"" {} \;
...@@ -247,8 +249,8 @@ rec { ...@@ -247,8 +249,8 @@ rec {
internal = mk_deriv { internal = mk_deriv {
name = "frama-c-internal"; name = "frama-c-internal";
inherit src; src = self.src;
buildInputs = (mk_buildInputs { opamPackages = [ "xml-light" ]; } ) ++ buildInputs = (self.mk_buildInputs { opamPackages = [ "xml-light" ]; } ) ++
[ pkgs.getopt [ pkgs.getopt
pkgs.libxslt pkgs.libxml2 pkgs.autoPatchelfHook pkgs.libxslt pkgs.libxml2 pkgs.autoPatchelfHook
pkgs.swiProlog pkgs.swiProlog
...@@ -320,4 +322,4 @@ rec { ...@@ -320,4 +322,4 @@ rec {
''; '';
}; };
} })
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment