nixpkgs/pkgs/applications/science/logic/why3/with-provers.nix

31 lines
825 B
Nix
Raw Normal View History

2019-06-19 02:01:38 +00:00
{ stdenv, makeWrapper, runCommand, symlinkJoin, why3 }:
provers:
let configAwkScript = runCommand "why3-conf.awk" { inherit provers; }
2021-08-16 20:50:19 +00:00
''
for p in $provers; do
for b in $p/bin/*; do
BASENAME=$(basename $b)
echo "/^command =/{ gsub(\"$BASENAME\", \"$b\") }" >> $out
2019-06-19 02:01:38 +00:00
done
2021-08-16 20:50:19 +00:00
done
echo '{ print }' >> $out
'';
in
stdenv.mkDerivation {
2019-06-19 02:01:38 +00:00
name = "${why3.name}-with-provers";
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ why3 ] ++ provers;
2019-06-19 02:01:38 +00:00
buildPhase = ''
2021-08-16 20:50:19 +00:00
mkdir -p $out/share/why3/
why3 config --detect-provers -C $out/share/why3/why3.conf
awk -i inplace -f ${configAwkScript} $out/share/why3/why3.conf
2019-06-19 02:01:38 +00:00
'';
installPhase = ''
2021-08-16 20:50:19 +00:00
mkdir -p $out/bin
makeWrapper ${why3}/bin/why3 $out/bin/why3 --add-flags "--extra-config $out/share/why3/why3.conf"
2019-06-19 02:01:38 +00:00
'';
}