mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 22:50:39 +00:00
atuin: add fish integration
This commit is contained in:
parent
192675b149
commit
462d4a7abd
4 changed files with 51 additions and 3 deletions
|
@ -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
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
25
tests/modules/programs/atuin/fish.nix
Normal file
25
tests/modules/programs/atuin/fish.nix
Normal 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'
|
||||
'';
|
||||
}
|
|
@ -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'
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue