diff --git a/pkgs/tools/filesystems/btrfs-progs/default.nix b/pkgs/tools/filesystems/btrfs-progs/default.nix index 9ad343f60a8c..936555f93a4d 100644 --- a/pkgs/tools/filesystems/btrfs-progs/default.nix +++ b/pkgs/tools/filesystems/btrfs-progs/default.nix @@ -2,6 +2,7 @@ , asciidoc, docbook_xml_dtd_45, docbook_xsl, libxslt, pkg-config, python3, xmlto , zstd , acl, attr, e2fsprogs, libuuid, lzo, systemd, zlib +, runCommand, btrfs-progs }: stdenv.mkDerivation rec { @@ -18,7 +19,7 @@ stdenv.mkDerivation rec { python3 python3.pkgs.setuptools ]; - buildInputs = [ acl attr e2fsprogs libuuid lzo python3 systemd zlib zstd ]; + buildInputs = [ acl attr e2fsprogs libuuid lzo python3 zlib zstd ] ++ lib.optionals stdenv.hostPlatform.isGnu [ systemd ]; # for python cross-compiling _PYTHON_HOST_PLATFORM = stdenv.hostPlatform.config; @@ -31,12 +32,21 @@ stdenv.mkDerivation rec { install -v -m 444 -D btrfs-completion $out/share/bash-completion/completions/btrfs ''; - configureFlags = lib.optional stdenv.hostPlatform.isMusl "--disable-backtrace"; + configureFlags = lib.optional stdenv.hostPlatform.isMusl "--disable-backtrace --disable-libudev"; - makeFlags = [ "udevruledir=$(out)/lib/udev/rules.d" ]; + makeFlags = lib.optionals stdenv.hostPlatform.isGnu [ "udevruledir=$(out)/lib/udev/rules.d" ]; enableParallelBuilding = true; + 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 ] + ''; + }; meta = with lib; { description = "Utilities for the btrfs filesystem"; homepage = "https://btrfs.wiki.kernel.org/";