mirror of
https://github.com/nix-community/home-manager.git
synced 2026-10-03 20:19:19 +00:00
Setting `core.pager` may result in issues like swallowed `git grep` results. To avoid this, apply pagers to specific commands where we expect `diff`-ish output only. Use a common helper to set pager for all modules that configure it.
48 lines
2.0 KiB
Nix
48 lines
2.0 KiB
Nix
{
|
|
lib,
|
|
options,
|
|
...
|
|
}:
|
|
|
|
{
|
|
programs.git = {
|
|
enable = true;
|
|
delta = {
|
|
enable = true;
|
|
options = {
|
|
features = "line-numbers decorations";
|
|
syntax-theme = "Dracula";
|
|
decorations = {
|
|
commit-decoration-style = "bold yellow box ul";
|
|
file-style = "bold yellow ul";
|
|
file-decoration-style = "none";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
test.asserts.warnings.expected = [
|
|
"The option `programs.git.delta.options' defined in ${lib.showFiles options.programs.git.delta.options.files} has been renamed to `programs.delta.options'."
|
|
"The option `programs.git.delta.enable' defined in ${lib.showFiles options.programs.git.delta.enable.files} has been renamed to `programs.delta.enable'."
|
|
"`programs.delta.enableGitIntegration` automatic enablement is deprecated. Please explicitly set `programs.delta.enableGitIntegration = true`."
|
|
];
|
|
|
|
nmt.script = ''
|
|
# Git config should contain delta configuration (backward compatibility)
|
|
assertFileExists home-files/.config/git/config
|
|
assertFileContains home-files/.config/git/config '[pager]'
|
|
assertFileRegex home-files/.config/git/config 'diff = .*/bin/delta'
|
|
assertFileRegex home-files/.config/git/config 'log = .*/bin/delta'
|
|
assertFileRegex home-files/.config/git/config 'show = .*/bin/delta'
|
|
assertFileContains home-files/.config/git/config '[interactive]'
|
|
assertFileRegex home-files/.config/git/config 'diffFilter = .*/bin/delta --color-only'
|
|
assertFileContains home-files/.config/git/config '[delta]'
|
|
assertFileContains home-files/.config/git/config 'features = "line-numbers decorations"'
|
|
assertFileContains home-files/.config/git/config 'syntax-theme = "Dracula"'
|
|
assertFileContains home-files/.config/git/config '[delta "decorations"]'
|
|
assertFileContains home-files/.config/git/config 'commit-decoration-style = "bold yellow box ul"'
|
|
assertFileContains home-files/.config/git/config 'file-decoration-style = "none"'
|
|
assertFileContains home-files/.config/git/config 'file-style = "bold yellow ul"'
|
|
'';
|
|
}
|