From 6caafcba3bdccda8cf32eeef91a23d323b42c797 Mon Sep 17 00:00:00 2001 From: aktaboot Date: Wed, 17 Jul 2024 20:25:13 +0200 Subject: [PATCH] bcachefs-tools: add fish,bash,zsh completions --- pkgs/by-name/bc/bcachefs-tools/package.nix | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/bc/bcachefs-tools/package.nix b/pkgs/by-name/bc/bcachefs-tools/package.nix index f145834ba7e8..7794c2bab876 100644 --- a/pkgs/by-name/bc/bcachefs-tools/package.nix +++ b/pkgs/by-name/bc/bcachefs-tools/package.nix @@ -22,6 +22,7 @@ nix-update-script, python3, fetchpatch, + installShellFiles, fuseSupport ? false, }: @@ -43,6 +44,7 @@ stdenv.mkDerivation (finalAttrs: { rustPlatform.cargoSetupHook rustPlatform.bindgenHook makeWrapper + installShellFiles ]; buildInputs = [ @@ -94,10 +96,17 @@ 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}/bin/python3" + '' + + 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 = { @@ -105,7 +114,7 @@ stdenv.mkDerivation (finalAttrs: { inherit (nixosTests.installer) bcachefsSimple bcachefsEncrypted bcachefsMulti; }; - updateScript = nix-update-script {}; + updateScript = nix-update-script { }; }; enableParallelBuilding = true;