about summary refs log tree commit diff
path: root/nixpkgs/pkgs/shells/bash/bash-completion/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/shells/bash/bash-completion/default.nix')
-rw-r--r--nixpkgs/pkgs/shells/bash/bash-completion/default.nix47
1 files changed, 41 insertions, 6 deletions
diff --git a/nixpkgs/pkgs/shells/bash/bash-completion/default.nix b/nixpkgs/pkgs/shells/bash/bash-completion/default.nix
index 0476cbd1f3f7..a741633340d6 100644
--- a/nixpkgs/pkgs/shells/bash/bash-completion/default.nix
+++ b/nixpkgs/pkgs/shells/bash/bash-completion/default.nix
@@ -1,15 +1,50 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchFromGitHub
+, fetchpatch
+, autoreconfHook
+, python3Packages
+, bashInteractive
+}:
 
 stdenv.mkDerivation rec {
   pname = "bash-completion";
-  version = "2.8";
+  # TODO: Remove musl patch below upon next release!
+  version = "2.9";
 
-  src = fetchurl {
-    url = "https://github.com/scop/bash-completion/releases/download/${version}/${pname}-${version}.tar.xz";
-    sha256 = "0kgmflrr1ga9wfk770vmakna3nj46ylb5ky9ipd0v2k9ymq5a7y0";
+  src = fetchFromGitHub {
+    owner = "scop";
+    repo = "bash-completion";
+    rev = version;
+    sha256 = "1813r4jxfa2zgzm2ppjhrq62flfmxai8433pklxcrl4fp5wwx9yv";
   };
 
-  doCheck = true;
+  nativeBuildInputs = [ autoreconfHook ];
+
+  doCheck = !stdenv.isDarwin;
+  checkInputs = [
+    python3Packages.pexpect
+    python3Packages.pytest
+    bashInteractive
+  ];
+
+  patches = [
+    ./0001-Revert-build-Do-cmake-pc-and-profile-variable-replac.patch
+    # TODO: Remove when https://github.com/scop/bash-completion/commit/2cdac1b9f24df62a1fa80c1824ee8524c9b02393
+    #       is availabe in a release in nixpkgs. see https://github.com/scop/bash-completion/issues/312.
+    # Fixes a test failure with musl.
+    (fetchpatch {
+     url = "https://github.com/scop/bash-completion/commit/2cdac1b9f24df62a1fa80c1824ee8524c9b02393.patch";
+     name = "bash-completion-musl-test_iconv-skip-option-completion-if-help-fails";
+     sha256 = "1l53d62zf01k625nzw3vcrxky93h7bzdpchgk4argxalrn17ckvb";
+    })
+  ];
+
+  # ignore ip_addresses because it tries to touch network
+  # ignore test_ls because impure logic
+  checkPhase = ''
+    pytest . \
+      --ignore=test/t/unit/test_unit_ip_addresses.py \
+      --ignore=test/t/test_ls.py
+  '';
 
   prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
     sed -i -e 's/readlink -f/readlink/g' bash_completion completions/*