mirror of
https://github.com/nix-community/home-manager.git
synced 2025-04-09 10:34:44 +00:00
carapace: conditionally disable unnecessary fish completion workaround on fish 4.0 (#6694)
The disabled workaround stopped being necessary with fish 4.0, as noted in https://carapace-sh.github.io/carapace-bin/setup.html#fish
This commit is contained in:
parent
f565da89e7
commit
b9da58d505
2 changed files with 17 additions and 8 deletions
|
@ -61,18 +61,23 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
xdg.configFile =
|
||||
mkIf (config.programs.fish.enable && cfg.enableFishIntegration) (
|
||||
xdg.configFile = mkIf (config.programs.fish.enable
|
||||
&& cfg.enableFishIntegration
|
||||
&& lib.versionOlder config.programs.fish.package.version "4.0.0") (
|
||||
# Convert the entries from `carapace --list` to empty
|
||||
# xdg.configFile."fish/completions/NAME.fish" entries.
|
||||
#
|
||||
# This is to disable fish builtin completion for each of the
|
||||
# carapace-supported completions It is in line with the instructions from
|
||||
# carapace-supported completions.
|
||||
#
|
||||
# This is necessary for carapace to properly work with fish version < 4.0b1.
|
||||
#
|
||||
# It is in line with the instructions from
|
||||
# carapace-bin:
|
||||
#
|
||||
# carapace --list | awk '{print $1}' | xargs -I{} touch ~/.config/fish/completions/{}.fish
|
||||
#
|
||||
# See https://github.com/rsteube/carapace-bin#getting-started
|
||||
# See https://carapace-sh.github.io/carapace-bin/setup.html#fish
|
||||
let
|
||||
carapaceListFile = pkgs.runCommandLocal "carapace-list" {
|
||||
buildInputs = [ cfg.package ];
|
||||
|
|
|
@ -8,13 +8,17 @@ lib.mkIf config.test.enableBig {
|
|||
|
||||
nixpkgs.overlays = [ (self: super: { inherit (realPkgs) carapace; }) ];
|
||||
|
||||
nmt.script = ''
|
||||
nmt.script = let
|
||||
needsCompletionOverrides = lib.versionOlder realPkgs.fish.version "4.0.0";
|
||||
in ''
|
||||
assertFileExists home-files/.config/fish/config.fish
|
||||
assertFileRegex home-files/.config/fish/config.fish \
|
||||
'/nix/store/.*carapace.*/bin/carapace _carapace fish \| source'
|
||||
|
||||
# Check whether completions are overridden.
|
||||
'' + (lib.optionalString needsCompletionOverrides ''
|
||||
# Check whether completions are overridden, necessary for fish < 4.0
|
||||
assertFileExists home-files/.config/fish/completions/git.fish
|
||||
assertFileContent home-files/.config/fish/completions/git.fish /dev/null
|
||||
'';
|
||||
'') + (lib.optionalString (!needsCompletionOverrides) ''
|
||||
assertPathNotExists home-files/.config/fish/completions
|
||||
'');
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue