about summary refs log tree commit diff
path: root/pkgs/applications/science
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2023-03-18 19:00:45 +0200
committerWeijia Wang <9713184+wegank@users.noreply.github.com>2023-03-18 19:00:45 +0200
commit0ddc01c5694ee1f80944f2a1f1fa1204638782c1 (patch)
tree452241aed2f894c8215f3cdc2e353ed8ca907e5f /pkgs/applications/science
parentd0781217d24406fb2217cab28f17163cf1badf19 (diff)
glucose: refactor
Diffstat (limited to 'pkgs/applications/science')
-rw-r--r--pkgs/applications/science/logic/glucose/default.nix27
-rw-r--r--pkgs/applications/science/logic/glucose/syrup.nix24
2 files changed, 20 insertions, 31 deletions
diff --git a/pkgs/applications/science/logic/glucose/default.nix b/pkgs/applications/science/logic/glucose/default.nix
index b9ca741a34770..5a0873b53f048 100644
--- a/pkgs/applications/science/logic/glucose/default.nix
+++ b/pkgs/applications/science/logic/glucose/default.nix
@@ -1,13 +1,21 @@
-{ lib, stdenv, fetchurl, zlib }:
+{ lib
+, stdenv
+, fetchurl
+, zlib
+, enableUnfree ? false
+}:
+
 stdenv.mkDerivation rec {
-  pname = "glucose";
+  pname = "glucose" + lib.optionalString enableUnfree "-syrup";
   version = "4.1";
 
   src = fetchurl {
     url = "http://www.labri.fr/perso/lsimon/downloads/softwares/glucose-syrup-${version}.tgz";
-    sha256 = "0aahrkaq7n0z986fpqz66yz946nxardfi6dh8calzcfjpvqiraji";
+    hash = "sha256-Uaoc8b7SsU8VQ7CZ6FpW3RqSvjfm4+sMSh/Yg9XMUCk=";
   };
 
+  sourceRoot = "glucose-syrup-${version}/${if enableUnfree then "parallel" else "simp"}";
+
   postPatch = ''
     substituteInPlace Main.cc \
       --replace "defined(__linux__)" "defined(__linux__) && defined(__x86_64__)"
@@ -15,17 +23,22 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ zlib ];
 
-  sourceRoot = "glucose-syrup-${version}/simp";
   makeFlags = [ "r" ];
+
   installPhase = ''
-    install -Dm0755 glucose_release $out/bin/glucose
+    runHook preInstall
+
+    install -Dm0755 ${pname}_release $out/bin/${pname}
     mkdir -p "$out/share/doc/${pname}-${version}/"
     install -Dm0755 ../{LICEN?E,README*,Changelog*} "$out/share/doc/${pname}-${version}/"
+
+    runHook postInstall
   '';
 
   meta = with lib; {
-    description = "Modern, parallel SAT solver (sequential version)";
-    license = licenses.mit;
+    description = "Modern, parallel SAT solver (${if enableUnfree then "parallel" else "sequential"} version)";
+    homepage = "https://www.labri.fr/perso/lsimon/research/glucose/";
+    license = if enableUnfree then licenses.unfreeRedistributable else licenses.mit;
     platforms = platforms.unix;
     maintainers = with maintainers; [ gebner ];
   };
diff --git a/pkgs/applications/science/logic/glucose/syrup.nix b/pkgs/applications/science/logic/glucose/syrup.nix
deleted file mode 100644
index 17342858fb8f3..0000000000000
--- a/pkgs/applications/science/logic/glucose/syrup.nix
+++ /dev/null
@@ -1,24 +0,0 @@
-{ lib, stdenv, zlib, glucose }:
-stdenv.mkDerivation rec {
-  pname = "glucose-syrup";
-  version = glucose.version;
-
-  src = glucose.src;
-
-  buildInputs = [ zlib ];
-
-  sourceRoot = "glucose-syrup-${version}/parallel";
-  makeFlags = [ "r" ];
-  installPhase = ''
-    install -Dm0755 glucose-syrup_release $out/bin/glucose-syrup
-    mkdir -p "$out/share/doc/${pname}-${version}/"
-    install -Dm0755 ../{LICEN?E,README*,Changelog*} "$out/share/doc/${pname}-${version}/"
-  '';
-
-  meta = with lib; {
-    description = "Modern, parallel SAT solver (parallel version)";
-    license = licenses.unfreeRedistributable;
-    platforms = platforms.unix;
-    maintainers = with maintainers; [ gebner ];
-  };
-}