diff --git a/nixos/tests/fish.nix b/nixos/tests/fish.nix index 86d6a3b9800e..61a81f5c6d0c 100644 --- a/nixos/tests/fish.nix +++ b/nixos/tests/fish.nix @@ -19,7 +19,7 @@ machine.wait_for_file("/etc/fish/generated_completions/coreutils.fish") machine.wait_for_file("/etc/fish/generated_completions/kill.fish") machine.succeed( - "fish -ic 'echo $fish_complete_path' | grep -q '/share/fish/completions /etc/fish/generated_completions /root/.local/share/fish/generated_completions$'" + "fish -ic 'echo $fish_complete_path' | grep -q '/share/fish/completions /etc/fish/generated_completions /root/.cache/fish/generated_completions$'" ) ''; } diff --git a/pkgs/by-name/fi/fish/package.nix b/pkgs/by-name/fi/fish/package.nix index e53da6a4a32d..ece968fd8d05 100644 --- a/pkgs/by-name/fi/fish/package.nix +++ b/pkgs/by-name/fi/fish/package.nix @@ -3,6 +3,7 @@ lib, fetchFromGitHub, coreutils, + darwin, glibcLocales, gnused, gnugrep, @@ -157,7 +158,11 @@ let hash = "sha256-BLbL5Tj3FQQCOeX5TWXMaxCpvdzZtKe5dDQi66uU/BM="; }; - env.FISH_BUILD_VERSION = finalAttrs.version; + env = { + FISH_BUILD_VERSION = finalAttrs.version; + # Skip tests that are known to be flaky in CI + CI = 1; + }; cargoDeps = rustPlatform.fetchCargoVendor { inherit (finalAttrs) src; @@ -190,42 +195,47 @@ let sed -i 's|"/bin/c"|"${lib.getExe' coreutils "c"}"|' src/tests/highlight.rs sed -i 's|"/bin/ca"|"${lib.getExe' coreutils "ca"}"|' src/tests/highlight.rs - sed -i 's|/usr|/build|' src/tests/highlight.rs + sed -i 's|/usr|/|' src/tests/highlight.rs # tests/checks/cd.fish - sed -i 's|/bin/pwd|${coreutils}/bin/pwd|' tests/checks/cd.fish + sed -i 's|/bin/pwd|${lib.getExe' coreutils "pwd"}|' tests/checks/cd.fish # tests/checks/redirect.fish - sed -i 's|/bin/echo|${coreutils}/bin/echo|' tests/checks/redirect.fish + sed -i 's|/bin/echo|${lib.getExe' coreutils "echo"}|' tests/checks/redirect.fish # tests/checks/vars_as_commands.fish sed -i 's|/usr/bin|${coreutils}/bin|' tests/checks/vars_as_commands.fish # tests/checks/jobs.fish - sed -i 's|ps -o stat|${procps}/bin/ps -o stat|' tests/checks/jobs.fish - sed -i 's|/bin/echo|${coreutils}/bin/echo|' tests/checks/jobs.fish + sed -i 's|ps -o stat|${lib.getExe' procps "ps"} -o stat|' tests/checks/jobs.fish + sed -i 's|/bin/echo|${lib.getExe' coreutils "echo"}|' tests/checks/jobs.fish # tests/checks/job-control-noninteractive.fish - sed -i 's|/bin/echo|${coreutils}/bin/echo|' tests/checks/job-control-noninteractive.fish + sed -i 's|/bin/echo|${lib.getExe' coreutils "echo"}|' tests/checks/job-control-noninteractive.fish # tests/checks/complete.fish + sed -i 's|/bin/ls|${lib.getExe' coreutils "ls"}|' tests/checks/complete.fish + sed -i 's|/bin/ls|${coreutils}/bin/ls|' tests/checks/complete.fish + + # pexpect tests are flaky + # See https://github.com/fish-shell/fish-shell/issues/8789 + rm tests/pexpects/exit_handlers.py + rm tests/pexpects/private_mode.py + rm tests/pexpects/history.py '' + lib.optionalString stdenv.hostPlatform.isDarwin '' # Tests use pkill/pgrep which are currently not built on Darwin # See https://github.com/NixOS/nixpkgs/pull/103180 + # and https://github.com/NixOS/nixpkgs/issues/141157 rm tests/pexpects/exit.py rm tests/pexpects/job_summary.py rm tests/pexpects/signals.py - - # pexpect tests are flaky in general - # See https://github.com/fish-shell/fish-shell/issues/8789 - rm tests/pexpects/bind.py + rm tests/pexpects/fg.py '' - + lib.optionalString stdenv.hostPlatform.isLinux '' - # pexpect tests are flaky on aarch64-linux (also x86_64-linux) - # See https://github.com/fish-shell/fish-shell/issues/8789 - rm tests/pexpects/exit_handlers.py + + lib.optionalString stdenv.hostPlatform.isAarch64 '' + # This test seems to consistently fail on aarch64 + rm tests/checks/cd.fish ''; outputs = [ @@ -286,12 +296,17 @@ let doCheck = true; - nativeCheckInputs = [ - coreutils - glibcLocales - (python3.withPackages (ps: [ ps.pexpect ])) - procps - ]; + nativeCheckInputs = + [ + coreutils + glibcLocales + (python3.withPackages (ps: [ ps.pexpect ])) + procps + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # For the getconf command, used in default-setup-path.fish + darwin.system_cmds + ]; checkTarget = "fish_run_tests"; preCheck = '' @@ -316,21 +331,21 @@ let postInstall = '' - sed -r "s|command grep|command ${gnugrep}/bin/grep|" \ + sed -r "s|command grep|command ${lib.getExe gnugrep}|" \ -i "$out/share/fish/functions/grep.fish" - sed -e "s|\|cut|\|${coreutils}/bin/cut|" \ + sed -e "s|\|cut|\|${lib.getExe' coreutils "cut"}|" \ -i "$out/share/fish/functions/fish_prompt.fish" - sed -e "s|uname|${coreutils}/bin/uname|" \ + sed -e "s|uname|${lib.getExe' coreutils "uname"}|" \ -i "$out/share/fish/functions/__fish_pwd.fish" \ "$out/share/fish/functions/prompt_pwd.fish" - sed -e "s|sed |${gnused}/bin/sed |" \ + sed -e "s|sed |${lib.getExe gnused} |" \ -i "$out/share/fish/functions/alias.fish" \ "$out/share/fish/functions/prompt_pwd.fish" - sed -i "s|nroff|${groff}/bin/nroff|" \ + sed -i "s|nroff|${lib.getExe' groff "nroff"}|" \ "$out/share/fish/functions/__fish_print_help.fish" sed -i "s|/usr/local/sbin /sbin /usr/sbin||" \ $out/share/fish/completions/{sudo.fish,doas.fish} - sed -e "s| awk | ${gawk}/bin/awk |" \ + sed -e "s| awk | ${lib.getExe' gawk "awk"} |" \ -i $out/share/fish/functions/{__fish_print_packages.fish,__fish_print_addresses.fish,__fish_describe_command.fish,__fish_complete_man.fish,__fish_complete_convert_options.fish} \ $out/share/fish/completions/{cwebp,adb,ezjail-admin,grunt,helm,heroku,lsusb,make,p4,psql,rmmod,vim-addons}.fish @@ -346,15 +361,15 @@ let '' + lib.optionalString stdenv.hostPlatform.isLinux '' for cur in $out/share/fish/functions/*.fish; do - sed -e "s|/usr/bin/getent|${getent}/bin/getent|" \ + sed -e "s|/usr/bin/getent|${lib.getExe getent}|" \ -i "$cur" done '' + lib.optionalString (!stdenv.hostPlatform.isDarwin) '' - sed -i "s|Popen(\['manpath'|Popen(\['${man-db}/bin/manpath'|" \ + sed -i "s|Popen(\['manpath'|Popen(\['${lib.getExe' man-db "manpath"}'|" \ "$out/share/fish/tools/create_manpage_completions.py" - sed -i "s|command manpath|command ${man-db}/bin/manpath|" \ + sed -i "s|command manpath|command ${lib.getExe' man-db "manpath"}|" \ "$out/share/fish/functions/man.fish" '' + lib.optionalString useOperatingSystemEtc ''