From 4de6574fb8d6289dc4960272e1e03482267995e0 Mon Sep 17 00:00:00 2001 From: "Narazaki, Shuji" Date: Sun, 29 Aug 2021 19:36:35 +0900 Subject: [PATCH] kissat: init at 2.0.1 --- .../science/logic/kissat/default.nix | 54 +++++++++++++++++++ .../logic/kissat/writable-passwd-is-ok.patch | 13 +++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 69 insertions(+) create mode 100644 pkgs/applications/science/logic/kissat/default.nix create mode 100644 pkgs/applications/science/logic/kissat/writable-passwd-is-ok.patch diff --git a/pkgs/applications/science/logic/kissat/default.nix b/pkgs/applications/science/logic/kissat/default.nix new file mode 100644 index 000000000000..08be0740117a --- /dev/null +++ b/pkgs/applications/science/logic/kissat/default.nix @@ -0,0 +1,54 @@ +{ lib, stdenv, fetchFromGitHub +, drat-trim, p7zip +}: + +stdenv.mkDerivation rec { + pname = "kissat"; + version = "2.0.1"; + + src = fetchFromGitHub { + owner = "arminbiere"; + repo = "kissat"; + # https://github.com/arminbiere/kissat/issues/18 + rev = "abfa45fb782fa3b7c6e2eb6b939febe74d7270b7"; + sha256 = "06pbmkjxgf2idhsrd1yzvbxr2wf8l06pjb38bzbygm6n9ami89b8"; + }; + + outputs = [ "out" "dev" "lib" ]; + + checkInputs = [ drat-trim p7zip ]; + doCheck = true; + + # 'make test' assumes that /etc/passwd is not writable. + patches = [ ./writable-passwd-is-ok.patch ]; + + # the configure script is not generated by autotools and does not accept the + # arguments that the default configurePhase passes like --prefix and --libdir + dontAddPrefix = true; + setOutputFlags = false; + + installPhase = '' + runHook preInstall + + install -Dm0755 build/kissat "$out/bin/kissat" + install -Dm0644 src/kissat.h "$dev/include/kissat.h" + install -Dm0644 build/libkissat.a "$lib/lib/libkissat.a" + mkdir -p "$out/share/doc/kissat/" + install -Dm0644 {LICEN?E,README*,VERSION} "$out/share/doc/kissat/" + + runHook postInstall + ''; + + meta = with lib; { + description = "A 'keep it simple and clean bare metal SAT solver' written in C"; + longDescription = '' + Kissat is a "keep it simple and clean bare metal SAT solver" written in C. + It is a port of CaDiCaL back to C with improved data structures, + better scheduling of inprocessing and optimized algorithms and implementation. + ''; + maintainers = with maintainers; [ shnarazk ]; + platforms = platforms.unix; + license = licenses.mit; + homepage = "http://fmv.jku.at/kissat"; + }; +} diff --git a/pkgs/applications/science/logic/kissat/writable-passwd-is-ok.patch b/pkgs/applications/science/logic/kissat/writable-passwd-is-ok.patch new file mode 100644 index 000000000000..f2cca54e1d36 --- /dev/null +++ b/pkgs/applications/science/logic/kissat/writable-passwd-is-ok.patch @@ -0,0 +1,13 @@ +diff --git a/test/testfile.c b/test/testfile.c +index cb311d5..0726244 100644 +--- a/test/testfile.c ++++ b/test/testfile.c +@@ -92,8 +92,6 @@ do { \ + WRITABLE (true, "../test/file/non-existing"); + WRITABLE (false, "/kissat-test-file-writable"); + WRITABLE (false, "non-existing-directory/file-in-non-existing-directory"); +- if (kissat_file_exists ("/etc/passwd")) +- WRITABLE (false, "/etc/passwd"); + #undef WRITABLE + } + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f65c917d975b..9595e843eca6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -30907,6 +30907,8 @@ with pkgs; honeytrap = callPackage ../tools/security/honeytrap { }; + kissat = callPackage ../applications/science/logic/kissat {}; + tini = callPackage ../applications/virtualization/tini {}; ifstat-legacy = callPackage ../tools/networking/ifstat-legacy { };