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