atuin: add module
This commit adds a module for configuring atuin, a replacement shell history program. The module adds options for generating atuin's `config.toml` from Nix, and options to enable atuin's integration for bash and zsh (which will rebind history keys to open the atuin history).
This commit is contained in:
parent
1719495bdf
commit
af2007bb77
13 changed files with 228 additions and 0 deletions
20
tests/modules/programs/atuin/bash.nix
Normal file
20
tests/modules/programs/atuin/bash.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs = {
|
||||
atuin.enable = true;
|
||||
bash.enable = true;
|
||||
};
|
||||
|
||||
test.stubs = {
|
||||
atuin = { };
|
||||
bash-preexec = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.bashrc
|
||||
assertFileContains \
|
||||
home-files/.bashrc \
|
||||
'eval "$(@atuin@/bin/atuin init bash)"'
|
||||
'';
|
||||
}
|
||||
7
tests/modules/programs/atuin/default.nix
Normal file
7
tests/modules/programs/atuin/default.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
atuin-bash = ./bash.nix;
|
||||
atuin-empty-settings = ./empty-settings.nix;
|
||||
atuin-example-settings = ./example-settings.nix;
|
||||
atuin-no-shell = ./no-shell.nix;
|
||||
atuin-zsh = ./zsh.nix;
|
||||
}
|
||||
14
tests/modules/programs/atuin/empty-settings.nix
Normal file
14
tests/modules/programs/atuin/empty-settings.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.atuin.enable = true;
|
||||
|
||||
test.stubs = {
|
||||
atuin = { };
|
||||
bash-preexec = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/atuin/config.toml
|
||||
'';
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
db_path = "~/.atuin-history.db"
|
||||
dialect = "us"
|
||||
auto_sync = true
|
||||
search-mode = "fulltext"
|
||||
32
tests/modules/programs/atuin/example-settings.nix
Normal file
32
tests/modules/programs/atuin/example-settings.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.atuin = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
db_path = "~/.atuin-history.db";
|
||||
dialect = "us";
|
||||
auto_sync = true;
|
||||
search-mode = "fulltext";
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs = {
|
||||
atuin = { };
|
||||
bash-preexec = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/atuin/config.toml \
|
||||
${
|
||||
builtins.toFile "example-settings-expected.toml" ''
|
||||
auto_sync = true
|
||||
db_path = "~/.atuin-history.db"
|
||||
dialect = "us"
|
||||
search-mode = "fulltext"
|
||||
''
|
||||
}
|
||||
'';
|
||||
}
|
||||
23
tests/modules/programs/atuin/no-shell.nix
Normal file
23
tests/modules/programs/atuin/no-shell.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs = {
|
||||
atuin = {
|
||||
enable = true;
|
||||
enableBashIntegration = false;
|
||||
enableZshIntegration = false;
|
||||
};
|
||||
bash.enable = true;
|
||||
zsh.enable = true;
|
||||
};
|
||||
|
||||
test.stubs = {
|
||||
atuin = { };
|
||||
bash-preexec = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileNotRegex home-files/.zshrc '@atuin@ init zsh'
|
||||
assertFileNotRegex home-files/.bashrc '@atuin@ init bash'
|
||||
'';
|
||||
}
|
||||
20
tests/modules/programs/atuin/zsh.nix
Normal file
20
tests/modules/programs/atuin/zsh.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs = {
|
||||
atuin.enable = true;
|
||||
zsh.enable = true;
|
||||
};
|
||||
|
||||
test.stubs = {
|
||||
atuin = { };
|
||||
bash-preexec = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.zshrc
|
||||
assertFileContains \
|
||||
home-files/.zshrc \
|
||||
'eval "$(@atuin@/bin/atuin init zsh)"'
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue