aboutsummaryrefslogtreecommitdiff
path: root/conjure/default.nix
blob: b695ddf8d354ed8ad699ee5a604be30e20cf297f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ stdenv
, patchelf
, gmp
, unzip
, lib
, fetchurl
, makeWrapper
, callPackage

, savilerow

, includeSolver ? true

, ...
}:

(stdenv.mkDerivation rec {
  pname = "conjure";
  version = "2.3.0";

  buildInputs = [ unzip makeWrapper ];
  libPath = lib.makeLibraryPath [ gmp ];
  binPath = if includeSolver
    then lib.makeBinPath [ savilerow savilerow.minion ]
    else "";

  src = fetchurl {
    url = "https://github.com/conjure-cp/conjure/releases/download/v${version}/${pname}-v${version}-linux.zip";
    sha256 = "cffa971f45438e0c2655d3546d61dc314dfdf05e8daf31d280131d515fc41f0e";
  };

  installPhase = ''
    mkdir -p $out/bin
    cp ./conjure $out/bin/conjure
    patchelf \
      --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
      --set-rpath "${libPath}" \
      $out/bin/conjure
    wrapProgram $out/bin/conjure \
      --prefix PATH : ${binPath}
  '';

  dontStrip = true;
}) // {
  containedSolvers = callPackage ./solvers.nix {};
}