1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-23 18:29:47 +01:00

atuin: add fish integration

This commit is contained in:
Mr Hedgehog 2022-01-20 17:07:29 -05:00 committed by Robert Helgesson
parent 192675b149
commit 462d4a7abd
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 51 additions and 3 deletions

View file

@ -40,6 +40,16 @@ in {
'';
};
enableFishIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Atuin's Fish integration.
</para><para>
If enabled, this will bind the up-arrow key to open the Atuin history.
'';
};
settings = mkOption {
type = with types;
let
@ -86,5 +96,9 @@ in {
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
eval "$(${cfg.package}/bin/atuin init zsh)"
'';
programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration ''
${cfg.package}/bin/atuin init fish | source
'';
};
}

View file

@ -2,6 +2,7 @@
atuin-bash = ./bash.nix;
atuin-empty-settings = ./empty-settings.nix;
atuin-example-settings = ./example-settings.nix;
atuin-fish = ./fish.nix;
atuin-no-shell = ./no-shell.nix;
atuin-zsh = ./zsh.nix;
}

View file

@ -0,0 +1,25 @@
{ lib, ... }:
{
programs = {
atuin.enable = true;
fish.enable = true;
};
# Needed to avoid error with dummy fish package.
xdg.dataFile."fish/home-manager_generated_completions".source =
lib.mkForce (builtins.toFile "empty" "");
test.stubs = {
atuin = { };
bash-preexec = { };
fish = { };
};
nmt.script = ''
assertFileExists home-files/.config/fish/config.fish
assertFileContains \
home-files/.config/fish/config.fish \
'atuin init fish | source'
'';
}

View file

@ -1,4 +1,4 @@
{ ... }:
{ lib, ... }:
{
programs = {
@ -6,18 +6,26 @@
enable = true;
enableBashIntegration = false;
enableZshIntegration = false;
enableFishIntegration = false;
};
bash.enable = true;
zsh.enable = true;
fish.enable = true;
};
# Needed to avoid error with dummy fish package.
xdg.dataFile."fish/home-manager_generated_completions".source =
lib.mkForce (builtins.toFile "empty" "");
test.stubs = {
atuin = { };
bash-preexec = { };
fish = { };
};
nmt.script = ''
assertFileNotRegex home-files/.zshrc '@atuin@ init zsh'
assertFileNotRegex home-files/.bashrc '@atuin@ init bash'
assertFileNotRegex home-files/.zshrc 'atuin init zsh'
assertFileNotRegex home-files/.bashrc 'atuin init bash'
assertFileNotRegex home-files/.config/fish/config.fish 'atuin init fish'
'';
}