2022-01-19 23:45:15 +00:00
|
|
|
{ lib, stdenv, fetchurl
|
2022-05-18 14:49:53 +00:00
|
|
|
, pkg-config, python3, sphinx
|
2022-01-19 23:45:15 +00:00
|
|
|
, zstd
|
2022-03-30 09:31:56 +00:00
|
|
|
, acl, attr, e2fsprogs, libuuid, lzo, udev, zlib
|
2022-01-26 04:04:25 +00:00
|
|
|
, runCommand, btrfs-progs
|
2022-05-18 14:49:53 +00:00
|
|
|
, gitUpdater
|
2022-08-21 13:32:41 +00:00
|
|
|
, udevSupport ? true
|
2022-09-09 14:08:57 +00:00
|
|
|
, enablePython ? true
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "btrfs-progs";
|
2022-11-27 09:42:12 +00:00
|
|
|
version = "6.0.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://kernel/linux/kernel/people/kdave/btrfs-progs/btrfs-progs-v${version}.tar.xz";
|
2022-11-27 09:42:12 +00:00
|
|
|
sha256 = "sha256-ZmWGMEnZRfwyzNrMVacwZ2eqj2QPO4sfpeBWijmucBg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2022-05-18 14:49:53 +00:00
|
|
|
pkg-config
|
2022-09-09 14:08:57 +00:00
|
|
|
] ++ lib.optionals enablePython [
|
2020-04-24 23:36:52 +00:00
|
|
|
python3 python3.pkgs.setuptools
|
2022-09-09 14:08:57 +00:00
|
|
|
] ++ [
|
2022-05-18 14:49:53 +00:00
|
|
|
sphinx
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
buildInputs = [ acl attr e2fsprogs libuuid lzo python3 udev zlib zstd ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# gcc bug with -O1 on ARM with gcc 4.8
|
|
|
|
# This should be fine on all platforms so apply universally
|
|
|
|
postPatch = "sed -i s/-O1/-O2/ configure";
|
|
|
|
|
|
|
|
postInstall = ''
|
2020-11-21 19:51:51 +00:00
|
|
|
install -v -m 444 -D btrfs-completion $out/share/bash-completion/completions/btrfs
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
configureFlags = lib.optionals stdenv.hostPlatform.isMusl [
|
|
|
|
"--disable-backtrace"
|
|
|
|
] ++ lib.optionals (!enablePython) [
|
|
|
|
"--disable-python"
|
|
|
|
] ++ lib.optionals (!udevSupport) [
|
|
|
|
"--disable-libudev"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
makeFlags = [ "udevruledir=$(out)/lib/udev/rules.d" ];
|
2022-01-19 23:45:15 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
installFlags = lib.optionals enablePython [ "install_python" ];
|
2022-05-18 14:49:53 +00:00
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-01-26 04:04:25 +00:00
|
|
|
passthru.tests = {
|
|
|
|
simple-filesystem = runCommand "btrfs-progs-create-fs" {} ''
|
|
|
|
mkdir -p $out
|
|
|
|
truncate -s110M $out/disc
|
|
|
|
${btrfs-progs}/bin/mkfs.btrfs $out/disc | tee $out/success
|
|
|
|
${btrfs-progs}/bin/btrfs check $out/disc | tee $out/success
|
|
|
|
[ -e $out/success ]
|
|
|
|
'';
|
|
|
|
};
|
2022-05-18 14:49:53 +00:00
|
|
|
|
|
|
|
passthru.updateScript = gitUpdater {
|
|
|
|
# No nicer place to find latest release.
|
|
|
|
url = "https://github.com/kdave/btrfs-progs.git";
|
|
|
|
rev-prefix = "v";
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Utilities for the btrfs filesystem";
|
|
|
|
homepage = "https://btrfs.wiki.kernel.org/";
|
2022-01-19 23:45:15 +00:00
|
|
|
license = licenses.gpl2Only;
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ raskin ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|