Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib
2, stdenv
3, fetchFromGitHub
4, pkg-config
5, docutils
6, libuuid
7, libscrypt
8, libsodium
9, keyutils
10, liburcu
11, zlib
12, libaio
13, zstd
14, lz4
15, python3Packages
16, util-linux
17, udev
18, valgrind
19, nixosTests
20, makeWrapper
21, getopt
22, fuse3
23, fuseSupport ? false
24}:
25
26stdenv.mkDerivation {
27 pname = "bcachefs-tools";
28 version = "unstable-2023-01-31";
29
30 src = fetchFromGitHub {
31 owner = "koverstreet";
32 repo = "bcachefs-tools";
33 rev = "3c39b422acd3346321185be0ce263809e2a9a23f";
34 hash = "sha256-2ci/m4JfodLiPoWfP+QCEqlk0k48zq3mKb8Pdrtln0o=";
35 };
36
37 postPatch = ''
38 patchShebangs .
39 substituteInPlace Makefile \
40 --replace "pytest-3" "pytest --verbose" \
41 --replace "INITRAMFS_DIR=/etc/initramfs-tools" \
42 "INITRAMFS_DIR=${placeholder "out"}/etc/initramfs-tools"
43 '';
44
45 nativeBuildInputs = [
46 pkg-config docutils python3Packages.python makeWrapper
47 ];
48
49 buildInputs = [
50 libuuid libscrypt libsodium keyutils liburcu zlib libaio
51 zstd lz4 python3Packages.pytest udev valgrind
52 ] ++ lib.optional fuseSupport fuse3;
53
54 doCheck = false; # needs bcachefs module loaded on builder
55 checkFlags = [ "BCACHEFS_TEST_USE_VALGRIND=no" ];
56 nativeCheckInputs = [ valgrind ];
57
58 preCheck = lib.optionalString fuseSupport ''
59 rm tests/test_fuse.py
60 '';
61
62 # this symlink is needed for mount -t bcachefs to work
63 postFixup = ''
64 ln -s $out/bin/mount.bcachefs.sh $out/bin/mount.bcachefs
65 wrapProgram $out/bin/mount.bcachefs.sh \
66 --prefix PATH : ${lib.makeBinPath [ getopt util-linux ]}
67 '';
68
69 installFlags = [ "PREFIX=${placeholder "out"}" ];
70
71 passthru.tests = {
72 smoke-test = nixosTests.bcachefs;
73 inherit (nixosTests.installer) bcachefsSimple bcachefsEncrypted bcachefsMulti;
74 };
75
76 enableParallelBuilding = true;
77
78 meta = with lib; {
79 description = "Tool for managing bcachefs filesystems";
80 homepage = "https://bcachefs.org/";
81 license = licenses.gpl2;
82 maintainers = with maintainers; [ davidak Madouura ];
83 platforms = platforms.linux;
84 };
85}