2021-07-14 22:03:04 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pkg-config
|
|
|
|
, docutils
|
|
|
|
, libuuid
|
|
|
|
, libscrypt
|
|
|
|
, libsodium
|
|
|
|
, keyutils
|
|
|
|
, liburcu
|
|
|
|
, zlib
|
|
|
|
, libaio
|
|
|
|
, zstd
|
|
|
|
, lz4
|
|
|
|
, python3Packages
|
2023-01-11 07:51:40 +00:00
|
|
|
, util-linux
|
2021-07-14 22:03:04 +00:00
|
|
|
, udev
|
|
|
|
, valgrind
|
|
|
|
, nixosTests
|
2023-01-11 07:51:40 +00:00
|
|
|
, makeWrapper
|
|
|
|
, getopt
|
2021-07-14 22:03:04 +00:00
|
|
|
, fuse3
|
|
|
|
, fuseSupport ? false
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "bcachefs-tools";
|
2023-02-09 11:40:11 +00:00
|
|
|
version = "unstable-2023-01-31";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "koverstreet";
|
|
|
|
repo = "bcachefs-tools";
|
2023-02-09 11:40:11 +00:00
|
|
|
rev = "3c39b422acd3346321185be0ce263809e2a9a23f";
|
|
|
|
hash = "sha256-2ci/m4JfodLiPoWfP+QCEqlk0k48zq3mKb8Pdrtln0o=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
2021-12-06 16:07:01 +00:00
|
|
|
patchShebangs .
|
2020-04-24 23:36:52 +00:00
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace "pytest-3" "pytest --verbose" \
|
|
|
|
--replace "INITRAMFS_DIR=/etc/initramfs-tools" \
|
2021-10-28 06:52:43 +00:00
|
|
|
"INITRAMFS_DIR=${placeholder "out"}/etc/initramfs-tools"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config docutils python3Packages.python makeWrapper
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libuuid libscrypt libsodium keyutils liburcu zlib libaio
|
2020-09-25 04:45:31 +00:00
|
|
|
zstd lz4 python3Packages.pytest udev valgrind
|
2021-01-15 22:18:51 +00:00
|
|
|
] ++ lib.optional fuseSupport fuse3;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
doCheck = false; # needs bcachefs module loaded on builder
|
2020-12-25 13:55:36 +00:00
|
|
|
checkFlags = [ "BCACHEFS_TEST_USE_VALGRIND=no" ];
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ valgrind ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
preCheck = lib.optionalString fuseSupport ''
|
2020-04-24 23:36:52 +00:00
|
|
|
rm tests/test_fuse.py
|
|
|
|
'';
|
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
# this symlink is needed for mount -t bcachefs to work
|
|
|
|
postFixup = ''
|
|
|
|
ln -s $out/bin/mount.bcachefs.sh $out/bin/mount.bcachefs
|
|
|
|
wrapProgram $out/bin/mount.bcachefs.sh \
|
|
|
|
--prefix PATH : ${lib.makeBinPath [ getopt util-linux ]}
|
|
|
|
'';
|
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
installFlags = [ "PREFIX=${placeholder "out"}" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
passthru.tests = {
|
|
|
|
smoke-test = nixosTests.bcachefs;
|
2022-05-18 14:49:53 +00:00
|
|
|
inherit (nixosTests.installer) bcachefsSimple bcachefsEncrypted bcachefsMulti;
|
2021-05-20 23:08:51 +00:00
|
|
|
};
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Tool for managing bcachefs filesystems";
|
|
|
|
homepage = "https://bcachefs.org/";
|
|
|
|
license = licenses.gpl2;
|
2022-03-30 09:31:56 +00:00
|
|
|
maintainers = with maintainers; [ davidak Madouura ];
|
2021-12-06 16:07:01 +00:00
|
|
|
platforms = platforms.linux;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|