aboutsummaryrefslogtreecommitdiff
path: root/conjure
diff options
context:
space:
mode:
authorTom Harley2020-12-06 13:55:04 +0000
committerTom Harley2020-12-06 13:55:04 +0000
commit62ed5302722e2ee819663d7f5eed5dd46651034b (patch)
treed34ff8079289f9f4c839f51dc601bc06c0bfce36 /conjure
parentAdd .gitignore (diff)
downloadmagpkgs-62ed5302722e2ee819663d7f5eed5dd46651034b.tar.gz
magpkgs-62ed5302722e2ee819663d7f5eed5dd46651034b.zip

Rewrite to treat as own package repo

Diffstat (limited to 'conjure')
-rw-r--r--conjure/default.nix77
-rw-r--r--conjure/solvers.nix52
2 files changed, 70 insertions, 59 deletions
diff --git a/conjure/default.nix b/conjure/default.nix
index 16628f2..6f21961 100644
--- a/conjure/default.nix
+++ b/conjure/default.nix
@@ -1,47 +1,44 @@
-let
- pkgs = import <nixpkgs> {};
+{ stdenv
+, patchelf
+, gmp
+, unzip
+, lib
+, fetchurl
+, makeWrapper
+, callPackage
-in
- { stdenv ? pkgs.stdenv
- , patchelf ? pkgs.patchelf
- , gmp ? pkgs.gmp
- , unzip ? pkgs.unzip
- , lib ? pkgs.lib
- , fetchurl ? pkgs.fetchurl
- , makeWrapper ? pkgs.makeWrapper
- , savilerow ? pkgs.callPackage ../savilerow {}
- , includeSolver ? true
- }:
+, savilerow
- (stdenv.mkDerivation rec {
- name = "conjure";
- version = "2.3.0";
+, includeSolver ? true
+}:
- buildInputs = [ unzip makeWrapper ];
- libPath = lib.makeLibraryPath [ gmp ];
- binPath = if includeSolver
- then lib.makeBinPath [ savilerow savilerow.minion ]
- else "";
+(stdenv.mkDerivation rec {
+ pname = "conjure";
+ version = "2.3.0";
- src = fetchurl {
- url = "https://github.com/conjure-cp/conjure/releases/download/v${version}/${name}-v${version}-linux.zip";
- sha256 = "cffa971f45438e0c2655d3546d61dc314dfdf05e8daf31d280131d515fc41f0e";
- };
+ buildInputs = [ unzip makeWrapper ];
+ libPath = lib.makeLibraryPath [ gmp ];
+ binPath = if includeSolver
+ then lib.makeBinPath [ savilerow savilerow.minion ]
+ else "";
- dontBuild = true;
+ 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}
- '';
+ 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 = import ./solvers.nix {};
- }
+ dontStrip = true;
+}) // {
+ containedSolvers = callPackage ./solvers.nix {};
+}
diff --git a/conjure/solvers.nix b/conjure/solvers.nix
index 3528c81..8692ab4 100644
--- a/conjure/solvers.nix
+++ b/conjure/solvers.nix
@@ -1,14 +1,18 @@
-let pkgs = import <nixpkgs> {}; in
+let pkgs = import <solvers> {}; in
{ stdenv ? pkgs.stdenv
, fetchurl ? pkgs.fetchurl
, lib ? pkgs.lib
, unzip ? pkgs.unzip
-, main_savilerow ? pkgs.callPackage ../savilerow {}
+, callPackage ? pkgs.callPackage
+
+, savilerow ? pkgs.savilerow
}:
let
- mkSolverDerivation = { name, libs ? [], static ? false, ... }@info: stdenv.mkDerivation (rec {
+ mkSolverDerivation = { pname, version ? "unknown", libs ? [], static ? false, ... }@info: stdenv.mkDerivation (rec {
+ inherit pname version;
+
buildInputs = [ unzip ];
src = fetchurl {
@@ -20,37 +24,47 @@ let
installPhase = ''
mkdir -p $out/bin
- cp ./${name} $out/bin/${name}
+ cp ./${pname} $out/bin/${pname}
${if static then "" else ''
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${libPath}" \
- $out/bin/${name}
+ $out/bin/${pname}
''}
'';
} // info);
- obj = builtins.foldl' (o: { name, ... }@info: o // { ${name} = mkSolverDerivation info; }) {};
+ double = { text }: y: text + y;
+
+ addNewSolverDerivation = o: info:
+ let
+ sdv = mkSolverDerivation info;
+ in
+ o // { ${sdv.name} = sdv; };
+
+ obj = builtins.foldl' addNewSolverDerivation {};
- addSavileRow = { minion, ... }@solvers: solvers // ({
- savilerow = (main_savilerow.overrideAttrs (old: {
+ addSavileRow = { minion-2, ... }@solvers: solvers // ({
+ savilerow = (savilerow.overrideAttrs (old: {
+ version = "1.7.0";
buildInputs = [ unzip ];
- src = solvers.minion.src;
- })).override { minion = solvers.minion; };
+ # minion is picked here but it could be any of the solvers
+ src = minion-2.src;
+ })).override { minion = minion-2; };
});
in with pkgs; addSavileRow (obj [
- { name = "bc_minisat_all_release"; libs = [ zlib ]; }
- { name = "fzn-chuffed"; libs = [ stdenv.cc.cc ]; dontStrip = true; }
- { name = "fzn-gecode"; libs = [ stdenv.cc.cc ]; dontStrip = true; }
- { name = "glucose"; libs = [ zlib ]; }
- { name = "glucose-syrup"; libs = [ zlib ]; }
- { name = "lingeling"; }
- { name = "nbc_minisat_all_release"; libs = [ zlib ]; }
- { name = "minion"; static = true; }
- { name = "open-wbo"; libs = [ zlib stdenv.cc.cc gmp gmpxx ]; dontStrip = true; }
+ { pname = "bc_minisat_all_release"; libs = [ zlib ]; }
+ { pname = "fzn-chuffed"; libs = [ stdenv.cc.cc ]; dontStrip = true; }
+ { pname = "fzn-gecode"; libs = [ stdenv.cc.cc ]; dontStrip = true; }
+ { pname = "glucose"; libs = [ zlib ]; }
+ { pname = "glucose-syrup"; libs = [ zlib ]; }
+ { pname = "lingeling"; }
+ { pname = "nbc_minisat_all_release"; libs = [ zlib ]; }
+ { pname = "minion"; version = "2"; static = true; }
+ { pname = "open-wbo"; libs = [ zlib stdenv.cc.cc gmp gmpxx ]; dontStrip = true; }
])