2021-05-20 01:12:17 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pkg-config
|
|
|
|
, docutils
|
|
|
|
, libuuid
|
|
|
|
, libscrypt
|
|
|
|
, libsodium
|
|
|
|
, keyutils
|
|
|
|
, liburcu
|
|
|
|
, zlib
|
|
|
|
, libaio
|
|
|
|
, zstd
|
|
|
|
, lz4
|
|
|
|
, python3Packages
|
2022-12-29 16:35:25 +00:00
|
|
|
, util-linux
|
2021-05-20 01:12:17 +00:00
|
|
|
, udev
|
|
|
|
, valgrind
|
|
|
|
, nixosTests
|
2022-12-29 16:35:25 +00:00
|
|
|
, makeWrapper
|
|
|
|
, getopt
|
2021-05-20 01:12:17 +00:00
|
|
|
, fuse3
|
|
|
|
, fuseSupport ? false
|
|
|
|
}:
|
2017-05-07 16:53:12 +00:00
|
|
|
|
2019-08-13 21:52:01 +00:00
|
|
|
stdenv.mkDerivation {
|
2019-01-14 02:24:53 +00:00
|
|
|
pname = "bcachefs-tools";
|
2023-02-02 21:32:34 +00:00
|
|
|
version = "unstable-2023-01-31";
|
2017-05-07 16:53:12 +00:00
|
|
|
|
2020-08-17 09:53:08 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "koverstreet";
|
|
|
|
repo = "bcachefs-tools";
|
2023-02-02 21:32:34 +00:00
|
|
|
rev = "3c39b422acd3346321185be0ce263809e2a9a23f";
|
|
|
|
hash = "sha256-2ci/m4JfodLiPoWfP+QCEqlk0k48zq3mKb8Pdrtln0o=";
|
2017-05-07 16:53:12 +00:00
|
|
|
};
|
|
|
|
|
2019-10-18 20:47:24 +00:00
|
|
|
postPatch = ''
|
2021-11-06 21:24:16 +00:00
|
|
|
patchShebangs .
|
2019-01-14 02:24:53 +00:00
|
|
|
substituteInPlace Makefile \
|
2019-10-18 20:47:24 +00:00
|
|
|
--replace "pytest-3" "pytest --verbose" \
|
2019-01-14 02:24:53 +00:00
|
|
|
--replace "INITRAMFS_DIR=/etc/initramfs-tools" \
|
2021-10-20 19:09:11 +00:00
|
|
|
"INITRAMFS_DIR=${placeholder "out"}/etc/initramfs-tools"
|
2018-08-06 13:58:12 +00:00
|
|
|
'';
|
2017-05-07 16:53:12 +00:00
|
|
|
|
2022-12-29 16:35:25 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config docutils python3Packages.python makeWrapper
|
|
|
|
];
|
2019-10-18 20:47:24 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libuuid libscrypt libsodium keyutils liburcu zlib libaio
|
2020-08-17 09:53:08 +00:00
|
|
|
zstd lz4 python3Packages.pytest udev valgrind
|
2021-01-15 09:19:50 +00:00
|
|
|
] ++ lib.optional fuseSupport fuse3;
|
2019-10-18 20:47:24 +00:00
|
|
|
|
2020-09-09 18:48:12 +00:00
|
|
|
doCheck = false; # needs bcachefs module loaded on builder
|
2020-11-29 00:02:40 +00:00
|
|
|
checkFlags = [ "BCACHEFS_TEST_USE_VALGRIND=no" ];
|
2023-01-21 12:00:00 +00:00
|
|
|
nativeCheckInputs = [ valgrind ];
|
2019-10-18 20:47:24 +00:00
|
|
|
|
2021-01-15 09:19:50 +00:00
|
|
|
preCheck = lib.optionalString fuseSupport ''
|
2019-10-18 20:47:24 +00:00
|
|
|
rm tests/test_fuse.py
|
|
|
|
'';
|
|
|
|
|
2022-12-29 16:35:25 +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-11-29 00:02:40 +00:00
|
|
|
installFlags = [ "PREFIX=${placeholder "out"}" ];
|
2019-10-18 20:47:24 +00:00
|
|
|
|
2021-04-03 22:34:28 +00:00
|
|
|
passthru.tests = {
|
|
|
|
smoke-test = nixosTests.bcachefs;
|
2022-05-05 00:57:52 +00:00
|
|
|
inherit (nixosTests.installer) bcachefsSimple bcachefsEncrypted bcachefsMulti;
|
2021-04-03 22:34:28 +00:00
|
|
|
};
|
|
|
|
|
2022-03-06 05:42:17 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2017-05-07 16:53:12 +00:00
|
|
|
description = "Tool for managing bcachefs filesystems";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://bcachefs.org/";
|
2017-05-07 16:53:12 +00:00
|
|
|
license = licenses.gpl2;
|
2022-03-14 08:52:18 +00:00
|
|
|
maintainers = with maintainers; [ davidak Madouura ];
|
2021-11-06 21:24:16 +00:00
|
|
|
platforms = platforms.linux;
|
2017-05-07 16:53:12 +00:00
|
|
|
};
|
|
|
|
}
|