nix-bash-completions icon indicating copy to clipboard operation
nix-bash-completions copied to clipboard

Support Nix 2.4

Open SuperSandro2000 opened this issue 4 years ago • 4 comments

so far only tested it with basic commands but it works better then before where the current line was cleared.

SuperSandro2000 avatar May 18 '21 16:05 SuperSandro2000

Nix 2.4 has its own completion script which collides with nix-bash-completions.

Maybe it would be better to remove completion for the nix command altogether when the Nix version is at least 2.4?

ncfavier avatar Jun 19 '21 13:06 ncfavier

I did that in an overlay where I combined the old and new one.

SuperSandro2000 avatar Jun 19 '21 15:06 SuperSandro2000

final: prev: {
  nix-bash-completions = prev.nix-bash-completions.overrideAttrs (oldAttrs: {
    patches = [
      # nom-build
      (final.fetchpatch {
        url = "https://github.com/hedning/nix-bash-completions/commit/2861e9b1b7351b77852444a79d164469ebbedd52.patch";
        sha256 = "sha256-L3NhFbnKwqP8+DaqG2/cufjQU7fuNhmXNMaC9m0YDEg=";
      })
      # nix 2.4 support
      (final.fetchpatch {
        url = "https://github.com/hedning/nix-bash-completions/commit/5d28f3de9244ccf679630770b90448a22a65aced.patch";
        sha256 = "sha256-Kez20a8YMvUe8lDVmzDCC8OmNX3taUMtjy917whlPUU=";
      })
    ];

    postPatch = ''
      substituteInPlace _nix \
        --replace "nix nixos-option" "nixos-option"

      cat ${prev.nixUnstable}/share/bash-completion/completions/nix >> _nix
    '';
  });
}

SuperSandro2000 avatar Jun 20 '21 22:06 SuperSandro2000

so far only tested it with basic commands but it works better then before where the current line was cleared.

Here's another PR that fixes "TAB completion erases line": https://github.com/hedning/nix-bash-completions/pull/21

bjornfor avatar Apr 20 '22 17:04 bjornfor