diff options
Diffstat (limited to 'pkgs/by-name/bc/bcachefs-tools/package.nix')
-rw-r--r-- | pkgs/by-name/bc/bcachefs-tools/package.nix | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/pkgs/by-name/bc/bcachefs-tools/package.nix b/pkgs/by-name/bc/bcachefs-tools/package.nix index f6f06296ac922..d755b2aaf785d 100644 --- a/pkgs/by-name/bc/bcachefs-tools/package.nix +++ b/pkgs/by-name/bc/bcachefs-tools/package.nix @@ -13,7 +13,6 @@ lz4, attr, udev, - nixosTests, fuse3, cargo, rustc, @@ -21,21 +20,21 @@ makeWrapper, nix-update-script, python3, - fetchpatch, + testers, + nixosTests, + installShellFiles, fuseSupport ? false, }: stdenv.mkDerivation (finalAttrs: { pname = "bcachefs-tools"; - version = "1.7.0-unstable-2024-05-09"; + version = "1.9.4"; src = fetchFromGitHub { owner = "koverstreet"; repo = "bcachefs-tools"; - # FIXME: switch to a tagged release once available > 1.7.0 - # Fix for https://github.com/NixOS/nixpkgs/issues/313350 - rev = "3ac510f6a41feb1b695381fa30869d557c00b822"; - hash = "sha256-ZmkeYPiCy7vkXnMFbtUF4761K+I+Ef7UbmSY7dJG09U="; + rev = "refs/tags/v${finalAttrs.version}"; + hash = "sha256-qPnlSl1s9QWkODqbrfzIVFLXtDVEmTOihBlDmvHoknY="; }; nativeBuildInputs = [ @@ -45,6 +44,7 @@ stdenv.mkDerivation (finalAttrs: { rustPlatform.cargoSetupHook rustPlatform.bindgenHook makeWrapper + installShellFiles ]; buildInputs = [ @@ -63,7 +63,7 @@ stdenv.mkDerivation (finalAttrs: { cargoDeps = rustPlatform.fetchCargoTarball { src = finalAttrs.src; - hash = "sha256-RsRz/nb8L+pL1U4l6RnvqeDFddPvcBFH4wdV7G60pxA="; + hash = "sha256-ufzxFEgeOaOcZKEPx7kT64Pj2oz6m35exqXQlKxXGb4="; }; makeFlags = [ @@ -80,18 +80,6 @@ stdenv.mkDerivation (finalAttrs: { # FIXME: Try enabling this once the default linux kernel is at least 6.7 doCheck = false; # needs bcachefs module loaded on builder - patches = [ - # code refactoring of bcachefs-tools broke reading passphrases from stdin (vs. terminal) - # upstream issue https://github.com/koverstreet/bcachefs-tools/issues/261 - ./fix-encrypted-boot.patch - # https://github.com/koverstreet/bcachefs-tools/pull/305 - (fetchpatch { - name = "use-ar-var-in-makefile.patch"; - url = "https://github.com/koverstreet/bcachefs-tools/commit/91e67ab2bd48fa135a1f5109b23899a4f1019a03.patch"; - sha256 = "sha256-nB4Tgcwa8eeasIDQ4rrYORie/X8LMuCSRi+WJNw+R/U="; - }) - ]; - postPatch = '' substituteInPlace Makefile \ --replace-fail "target/release/bcachefs" "target/${stdenv.hostPlatform.rust.rustcTargetSpec}/release/bcachefs" @@ -108,18 +96,30 @@ stdenv.mkDerivation (finalAttrs: { "PKGCONFIG_UDEVDIR=$(out)/lib/udev" ]; - postInstall = '' - substituteInPlace $out/libexec/bcachefsck_all \ - --replace-fail "/usr/bin/python3" "${python3}/bin/python3" - ''; + postInstall = + '' + substituteInPlace $out/libexec/bcachefsck_all \ + --replace-fail "/usr/bin/python3" "${python3.interpreter}" + '' + + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd bcachefs \ + --bash <($out/sbin/bcachefs completions bash) \ + --zsh <($out/sbin/bcachefs completions zsh) \ + --fish <($out/sbin/bcachefs completions fish) + ''; passthru = { tests = { + version = testers.testVersion { + package = finalAttrs.finalPackage; + command = "${finalAttrs.meta.mainProgram} version"; + version = "${finalAttrs.version}"; + }; smoke-test = nixosTests.bcachefs; inherit (nixosTests.installer) bcachefsSimple bcachefsEncrypted bcachefsMulti; }; - updateScript = nix-update-script {}; + updateScript = nix-update-script { }; }; enableParallelBuilding = true; @@ -134,5 +134,6 @@ stdenv.mkDerivation (finalAttrs: { Madouura ]; platforms = lib.platforms.linux; + mainProgram = "bcachefs"; }; }) |