1{ stdenv, fetchFromGitHub
2, fetchpatch
3, autoreconfHook
4, perl
5, ps
6, python3Packages
7, bashInteractive
8}:
9
10stdenv.mkDerivation rec {
11 pname = "bash-completion";
12 version = "2.10";
13
14 src = fetchFromGitHub {
15 owner = "scop";
16 repo = "bash-completion";
17 rev = version;
18 sha256 = "047yjryy9d6hp18wkigbfrw9r0sm31inlsp8l28fhxg8ii032sgq";
19 };
20
21 nativeBuildInputs = [ autoreconfHook ];
22
23 # tests are super flaky unfortunately, and regularily break.
24 # let's disable them for now.
25 doCheck = false;
26 checkInputs = [
27 # perl is assumed by perldoc completion
28 perl
29 # ps assumed to exist by gdb, killall, pgrep, pidof,
30 # pkill, pwdx, renice, and reptyr completions
31 ps
32 python3Packages.pexpect
33 python3Packages.pytest
34 bashInteractive
35 ];
36
37 # - ignore test_gcc on ARM because it assumes -march=native
38 # - ignore test_chsh because it assumes /etc/shells exists
39 # - ignore test_ether_wake, test_ifdown, test_ifstat, test_ifup,
40 # test_iperf, test_iperf3, test_nethogs and ip_addresses
41 # because they try to touch network
42 # - ignore test_ls because impure logic
43 # - ignore test_screen because it assumes vt terminals exist
44 checkPhase = ''
45 pytest . \
46 ${stdenv.lib.optionalString (stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isAarch32) "--ignore=test/t/test_gcc.py"} \
47 --ignore=test/t/test_chsh.py \
48 --ignore=test/t/test_ether_wake.py \
49 --ignore=test/t/test_ifdown.py \
50 --ignore=test/t/test_ifstat.py \
51 --ignore=test/t/test_ifup.py \
52 --ignore=test/t/test_iperf.py \
53 --ignore=test/t/test_iperf3.py \
54 --ignore=test/t/test_nethogs.py \
55 --ignore=test/t/unit/test_unit_ip_addresses.py \
56 --ignore=test/t/test_ls.py \
57 --ignore=test/t/test_screen.py
58 '';
59
60 prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
61 sed -i -e 's/readlink -f/readlink/g' bash_completion completions/*
62 '';
63
64 meta = with stdenv.lib; {
65 homepage = "https://github.com/scop/bash-completion";
66 description = "Programmable completion for the bash shell";
67 license = licenses.gpl2Plus;
68 platforms = platforms.unix;
69 maintainers = [ maintainers.peti maintainers.xfix ];
70 };
71}