bat and git-delta

This commit is contained in:
Grimmauld 2024-05-17 12:18:20 +02:00
parent 21ad9a362a
commit 6cb15ad29e
Signed by: Grimmauld
GPG key ID: C2946668769F91FB
5 changed files with 115 additions and 41 deletions

View file

@ -8,8 +8,6 @@ let
inherit (config.grimmShared) enable tooling graphical;
inherit (lib)
mkEnableOption
mkOption
types
getExe
optionals
mkIf
@ -24,6 +22,7 @@ in
./rust.nix
./nvim.nix
./lsp.nix
./git.nix
];
config = mkIf (enable && tooling.enable) {
@ -33,13 +32,13 @@ in
(writeShellScriptBin "systemd-owner" "systemctl show -pUser,UID $@")
(writeShellScriptBin "tree" "${getExe eza} -T --git -lh --no-permissions --no-user --no-filesize --no-time")
(writeShellScriptBin "spawn" ''exec "$@" &> /dev/null &'')
(writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@")
urlencode
rfindup
pstree
file
wget
bat
hyfetch
util-linux
btop
@ -52,8 +51,6 @@ in
unzip
p7zip
tea
fbcat
gomuks
ranger
@ -76,30 +73,11 @@ in
jetbrains.idea-community
];
programs.git = {
enable = true;
lfs.enable = true;
config = {
init.defaultBranch = "main";
credential.username = tooling.git_user;
user.name = tooling.git_user;
user.email = tooling.git_email;
push.autoSetupRemote = true;
core.autocrlf = "input";
commit.gpgsign = true;
pull.rebase = true;
alias = {
pfusch = "push --force-with-lease --force-if-includes";
fuck = "reset HEAD~1";
fixup = "commit --fixup";
};
};
};
environment.shellAliases = {
":q" = "exit";
"ls" = "eza";
"lix" = "nix";
"bat" = "bat --theme=Dracula";
};
programs.tmux = {
@ -108,6 +86,11 @@ in
#keyMode = "vi";
};
environment.sessionVariables = {
MANPAGER = "sh -c 'col -bx | ${getExe pkgs.bat} -l man -p'";
MANROFFOPT = "-c";
};
# virtualisation.docker.enable = true;
services.dbus.implementation = "broker";
@ -125,16 +108,5 @@ in
options.grimmShared.tooling = {
enable = mkEnableOption "grimm-tooling";
git_user = mkOption {
type = types.str;
default = "Grimmauld";
description = "Username for git to use";
};
git_email = mkOption {
type = types.str;
default = "${config.grimmShared.tooling.git_user}@grimmauld.de";
description = "Email for git to use";
};
};
}

85
common/tooling/git.nix Normal file
View file

@ -0,0 +1,85 @@
{
pkgs,
config,
lib,
...
}:
let
inherit (config.grimmShared) enable tooling;
inherit (lib)
mkOption
types
getExe
mkIf
;
in
{
imports = [
./lilypond.nix
./nix.nix
./security.nix
./python.nix
./rust.nix
./nvim.nix
./lsp.nix
];
config = mkIf (enable && tooling.enable) {
environment.systemPackages = [
(pkgs.writeShellScriptBin "silent-add" "${getExe config.programs.git.package} add --intent-to-add $@ ; ${getExe config.programs.git.package} update-index --assume-unchanged $@")
pkgs.urlencode
pkgs.tea
pkgs.delta
];
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [ fugitive ];
programs.git = {
enable = true;
lfs.enable = true;
config = {
init.defaultBranch = "main";
credential.username = tooling.git_user;
user.name = tooling.git_user;
user.email = tooling.git_email;
push.autoSetupRemote = true;
core.autocrlf = "input";
commit.gpgsign = true;
pull.rebase = true;
include.path = "${pkgs.delta.src}/themes.gitconfig";
core.pager = "delta";
interactive.diffFilter = "delta --color-only";
delta = {
navigate = true;
features = "mantis-shrimp";
};
merge.conflictstyle = "diff3";
diff.colorMoved = "default";
alias = {
pfusch = "push --force-with-lease --force-if-includes";
fuck = "reset HEAD~1";
fixup = "commit --fixup";
};
};
};
};
options.grimmShared.tooling = {
git_user = mkOption {
type = types.str;
default = "Grimmauld";
description = "Username for git to use";
};
git_email = mkOption {
type = types.str;
default = "${config.grimmShared.tooling.git_user}@grimmauld.de";
description = "Email for git to use";
};
};
}

View file

@ -38,9 +38,7 @@ in
{
config = mkIf (enable && tooling.enable) {
environment.systemPackages =
[
pkgs.treefmt
]
[ pkgs.treefmt ]
++ (map (v: v.lsp.package) (filter (v: !isNull v.lsp) tooling.lang_servers))
++ (map (v: v.fmt.package) (filter (v: !isNull v.fmt) tooling.lang_servers));

View file

@ -23,7 +23,7 @@ in
programs.git.config.core.editor = getExe pkgs.neovim;
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [ fugitive ];
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [ vim-monokai-pro ];
programs.neovim = {
enable = true;
@ -42,6 +42,25 @@ in
set nocompatible
set clipboard+=unnamedplus
set ff=unix
set termguicolors
colorscheme monokai_pro
hi Normal guibg=NONE ctermbg=NONE
hi NonText guibg=NONE ctermbg=NONE
" Toggle transparent background
let t:is_transparent = 1
function! Toggle_transparent()
if t:is_transparent == 0
hi Normal guibg=NONE ctermbg=NONE
hi NonText guibg=NONE ctermbg=NONE
let t:is_transparent = 1
else
set background=dark
hi EndOfBuffer ctermfg=bg
let t:is_transparent = 0
endif
endfunction
nnoremap <F12> : call Toggle_transparent()<CR>
luafile ${luarc}

View file

@ -28,7 +28,7 @@ in
name: value: "aliases[\"${name}\"] = '''${value}'''"
) config.environment.shellAliases
);
package = pkgs.xonsh.wrapper.override { extraPackages = pyLibs; };
# package = pkgs.xonsh.wrapper.override { extraPackages = pyLibs; };
};
grimmShared.tooling.lang_servers = [