1{ stdenv, fetchurl, fetchpatch, lvm2, json_c
2, openssl, libuuid, pkgconfig, popt
3, enablePython ? false, python2 ? null }:
4
5assert enablePython -> python2 != null;
6
7stdenv.mkDerivation rec {
8 name = "cryptsetup-2.0.6";
9
10 outputs = [ "out" "dev" "man" ];
11
12 src = fetchurl {
13 url = "mirror://kernel/linux/utils/cryptsetup/v2.0/${name}.tar.xz";
14 sha256 = "0c1x125s7p4ps13spsqrcsd9dclz01vsrchmypq9msp7y3hgllbw";
15 };
16
17 # Disable 4 test cases that fail in a sandbox
18 patches = [ ./disable-failing-tests.patch ];
19
20 postPatch = ''
21 patchShebangs tests
22 ${stdenv.lib.optionalString enablePython ''
23 patchShebangs ./python/pycryptsetup-test.py
24 ''}
25
26 # O_DIRECT is filesystem dependent and fails in a sandbox (on tmpfs)
27 # and on several filesystem types (btrfs, zfs) without sandboxing.
28 # Remove it, see discussion in #46151
29 substituteInPlace tests/unit-utils-io.c --replace "| O_DIRECT" ""
30 '';
31
32 NIX_LDFLAGS = "-lgcc_s";
33
34 configureFlags = [
35 "--disable-kernel_crypto"
36 "--enable-cryptsetup-reencrypt"
37 "--with-crypto_backend=openssl"
38 ] ++ stdenv.lib.optional enablePython "--enable-python";
39
40 nativeBuildInputs = [ pkgconfig ];
41 buildInputs = [ lvm2 json_c openssl libuuid popt ]
42 ++ stdenv.lib.optional enablePython python2;
43
44 doCheck = true;
45
46 meta = {
47 homepage = https://gitlab.com/cryptsetup/cryptsetup/;
48 description = "LUKS for dm-crypt";
49 license = stdenv.lib.licenses.gpl2;
50 maintainers = with stdenv.lib.maintainers; [ ];
51 platforms = with stdenv.lib.platforms; linux;
52 };
53}