From d72f22607acd26c04f4447f3db99946aa15f9fe2 Mon Sep 17 00:00:00 2001
From: Yegor Timoshenko <yegortimoshenko@riseup.net>
Date: Tue, 3 Apr 2018 11:25:13 +0000
Subject: [PATCH 1/2] cryptsetup: 1.7.5 -> 2.0.2

---
 pkgs/os-specific/linux/cryptsetup/default.nix | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pkgs/os-specific/linux/cryptsetup/default.nix b/pkgs/os-specific/linux/cryptsetup/default.nix
index ef8c55853a3..e2917c81e15 100644
--- a/pkgs/os-specific/linux/cryptsetup/default.nix
+++ b/pkgs/os-specific/linux/cryptsetup/default.nix
@@ -1,22 +1,22 @@
-{ stdenv, fetchurl, devicemapper, openssl, libuuid, pkgconfig, popt
+{ stdenv, fetchurl, devicemapper, json_c, openssl, libuuid, pkgconfig, popt
 , enablePython ? false, python2 ? null
 }:
 
 assert enablePython -> python2 != null;
 
 stdenv.mkDerivation rec {
-  name = "cryptsetup-1.7.5";
+  name = "cryptsetup-2.0.2";
 
   src = fetchurl {
-    url = "mirror://kernel/linux/utils/cryptsetup/v1.7/${name}.tar.xz";
-    sha256 = "1gail831j826lmpdx2gsc83lp3br6wfnwh3vqwxaa1nn1lfwsc1b";
+    url = "mirror://kernel/linux/utils/cryptsetup/v2.0/${name}.tar.xz";
+    sha256 = "15wyjfgcqjf0wy5gxnmjj8aah33csv5v6n1hv9c8sxdzygbhb0ag";
   };
 
   configureFlags = [ "--enable-cryptsetup-reencrypt" "--with-crypto_backend=openssl" ]
                 ++ stdenv.lib.optional enablePython "--enable-python";
 
   nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ devicemapper openssl libuuid popt ]
+  buildInputs = [ devicemapper json_c openssl libuuid popt ]
              ++ stdenv.lib.optional enablePython python2;
 
   meta = {

From 397f5c37df025e561b0cc94e71077fa0a06679f6 Mon Sep 17 00:00:00 2001
From: Yegor Timoshenko <yegortimoshenko@riseup.net>
Date: Fri, 15 Jun 2018 23:20:53 +0000
Subject: [PATCH 2/2] =?UTF-8?q?cryptsetup:=20apply=20Mat=C3=ADas=20Lang's?=
 =?UTF-8?q?=20patch?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 pkgs/os-specific/linux/cryptsetup/default.nix | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/pkgs/os-specific/linux/cryptsetup/default.nix b/pkgs/os-specific/linux/cryptsetup/default.nix
index e2917c81e15..4a64154b585 100644
--- a/pkgs/os-specific/linux/cryptsetup/default.nix
+++ b/pkgs/os-specific/linux/cryptsetup/default.nix
@@ -1,6 +1,5 @@
 { stdenv, fetchurl, devicemapper, json_c, openssl, libuuid, pkgconfig, popt
-, enablePython ? false, python2 ? null
-}:
+, enablePython ? false, python2 ? null }:
 
 assert enablePython -> python2 != null;
 
@@ -12,12 +11,17 @@ stdenv.mkDerivation rec {
     sha256 = "15wyjfgcqjf0wy5gxnmjj8aah33csv5v6n1hv9c8sxdzygbhb0ag";
   };
 
-  configureFlags = [ "--enable-cryptsetup-reencrypt" "--with-crypto_backend=openssl" ]
-                ++ stdenv.lib.optional enablePython "--enable-python";
+  NIX_LDFLAGS = "-lgcc_s";
+
+  configureFlags = [
+    "--disable-kernel_crypto"
+    "--enable-cryptsetup-reencrypt"
+    "--with-crypto_backend=openssl"
+  ] ++ stdenv.lib.optional enablePython "--enable-python";
 
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ devicemapper json_c openssl libuuid popt ]
-             ++ stdenv.lib.optional enablePython python2;
+    ++ stdenv.lib.optional enablePython python2;
 
   meta = {
     homepage = https://gitlab.com/cryptsetup/cryptsetup/;