diff --git a/packages/packages.nix b/packages/packages.nix index 3a2fb25..e58801e 100644 --- a/packages/packages.nix +++ b/packages/packages.nix @@ -19,6 +19,8 @@ in { amberol = sandbox ./nixpak/amberol { }; + bcachefs-tools = pkgs.callPackage ./tools/bcachefs-tools { }; + brig = pkgs.callPackage ./tools/brig { }; privatevoid-smart-card-ca-bundle = pkgs.callPackage ./data/privatevoid-smart-card-certificate-authority-bundle.nix { }; diff --git a/packages/tools/bcachefs-tools/default.nix b/packages/tools/bcachefs-tools/default.nix new file mode 100644 index 0000000..e72a801 --- /dev/null +++ b/packages/tools/bcachefs-tools/default.nix @@ -0,0 +1,73 @@ +{ lib +, stdenv +, fetchFromGitHub +, pkg-config +, docutils +, libuuid +, libscrypt +, libsodium +, keyutils +, liburcu +, zlib +, libaio +, zstd +, lz4 +, python3Packages +, udev +, valgrind +, nixosTests +, fuse3 +, fuseSupport ? false +}: + +stdenv.mkDerivation { + pname = "bcachefs-tools"; + version = "unstable-2022-12-03"; + + src = fetchFromGitHub { + owner = "koverstreet"; + repo = "bcachefs-tools"; + rev = "787768043dba6646712eef77c8076f3bfb0621cb"; + sha256 = "sha256-Mtbfg6tiQvzSrR6Rp4ZUnM2d4nxaAYE7eeINLxiWzqQ="; + }; + + postPatch = '' + patchShebangs . + substituteInPlace Makefile \ + --replace "pytest-3" "pytest --verbose" \ + --replace "INITRAMFS_DIR=/etc/initramfs-tools" \ + "INITRAMFS_DIR=${placeholder "out"}/etc/initramfs-tools" + ''; + + nativeBuildInputs = [ pkg-config docutils python3Packages.python ]; + + buildInputs = [ + libuuid libscrypt libsodium keyutils liburcu zlib libaio + zstd lz4 python3Packages.pytest udev valgrind + ] ++ lib.optional fuseSupport fuse3; + + doCheck = false; # needs bcachefs module loaded on builder + checkFlags = [ "BCACHEFS_TEST_USE_VALGRIND=no" ]; + checkInputs = [ valgrind ]; + + preCheck = lib.optionalString fuseSupport '' + rm tests/test_fuse.py + ''; + + installFlags = [ "PREFIX=${placeholder "out"}" ]; + + passthru.tests = { + smoke-test = nixosTests.bcachefs; + inherit (nixosTests.installer) bcachefsSimple bcachefsEncrypted bcachefsMulti; + }; + + enableParallelBuilding = true; + + meta = with lib; { + description = "Tool for managing bcachefs filesystems"; + homepage = "https://bcachefs.org/"; + license = licenses.gpl2; + maintainers = with maintainers; [ davidak Madouura ]; + platforms = platforms.linux; + }; +}