refactor: move some other stuff into common bash

This commit is contained in:
matt1432 2023-10-15 15:11:59 -04:00
parent 2da47844ad
commit 9d00443094
4 changed files with 254 additions and 253 deletions

View file

@ -1,162 +1,170 @@
# Home-manager module # Home-manager module
{ lib, ... }: { lib, ... }: {
programs = {
{
programs.starship = let
textColor = "#e3e5e5";
firstColor = "#bd93f9";
secondColor = "#715895";
thirdColor = "#382c4a";
fourthColor = "#120e18";
in {
enable = true;
enableBashIntegration = true;
settings = {
format = lib.concatStrings [
""
"[](fg:${firstColor})"
"[ ](bg:${firstColor} fg:#090c0c)"
"[](bg:${secondColor} fg:${firstColor})"
"$username$hostname"
"$sudo"
"[](fg:${secondColor} bg:${thirdColor})"
"$directory"
"[](fg:${thirdColor} bg:${fourthColor})"
"$git_branch"
"[](fg:${fourthColor})"
"\n$shlvl$nix_shell$character"
];
sudo = { fzf = {
disabled = false; enable = true;
style = "fg:${textColor} bg:${secondColor}"; enableBashIntegration = true;
format = "[as root ]($style)"; };
}; jq.enable = true;
ripgrep.enable = true;
username = { starship = let
show_always = true; textColor = "#e3e5e5";
style_user = "fg:${textColor} bg:${secondColor}"; firstColor = "#bd93f9";
style_root = "fg:red bg:${secondColor} blink"; secondColor = "#715895";
format = "[ $user]($style)"; thirdColor = "#382c4a";
}; fourthColor = "#120e18";
in {
enable = true;
enableBashIntegration = true;
settings = {
format = lib.concatStrings [
""
"[](fg:${firstColor})"
"[ ](bg:${firstColor} fg:#090c0c)"
"[](bg:${secondColor} fg:${firstColor})"
"$username$hostname"
"$sudo"
"[](fg:${secondColor} bg:${thirdColor})"
"$directory"
"[](fg:${thirdColor} bg:${fourthColor})"
"$git_branch"
"[](fg:${fourthColor})"
"\n$shlvl$nix_shell$character"
];
hostname = { sudo = {
ssh_only = false; disabled = false;
style = "fg:${textColor} bg:${secondColor}"; style = "fg:${textColor} bg:${secondColor}";
format = "[@$hostname ]($style)"; format = "[as root ]($style)";
}; };
directory = { username = {
style = "fg:${firstColor} bg:${thirdColor}"; show_always = true;
format = "[ $path ]($style)"; style_user = "fg:${textColor} bg:${secondColor}";
truncate_to_repo = false; style_root = "fg:red bg:${secondColor} blink";
truncation_length = 0; format = "[ $user]($style)";
};
substitutions = { hostname = {
"Documents" = "󰈙 "; ssh_only = false;
"Downloads" = " "; style = "fg:${textColor} bg:${secondColor}";
"Music" = " "; format = "[@$hostname ]($style)";
"Pictures" = " "; };
directory = {
style = "fg:${firstColor} bg:${thirdColor}";
format = "[ $path ]($style)";
truncate_to_repo = false;
truncation_length = 0;
substitutions = {
"Documents" = "󰈙 ";
"Downloads" = " ";
"Music" = " ";
"Pictures" = " ";
};
};
git_branch = {
style = "fg:${secondColor} bg:${fourthColor}";
symbol = "";
format = "[ $symbol $branch ]($style)";
};
shlvl = {
disabled = false;
repeat = true;
symbol = "󰔳 ";
format = "[$symbol]($style)";
threshold = 1;
};
nix_shell = {
symbol = " ";
format = "[$symbol]($style)";
};
character = {
success_symbol = "[\\$](bold green)";
error_symbol = "[\\$](bold red)";
}; };
}; };
git_branch = {
style = "fg:${secondColor} bg:${fourthColor}";
symbol = "";
format = "[ $symbol $branch ]($style)";
};
shlvl = {
disabled = false;
repeat = true;
symbol = "󰔳 ";
format = "[$symbol]($style)";
threshold = 1;
};
nix_shell = {
symbol = " ";
format = "[$symbol]($style)";
};
character = {
success_symbol = "[\\$](bold green)";
error_symbol = "[\\$](bold red)";
};
};
};
programs.bash = {
enable = true;
enableCompletion = true;
historyFile = "\$HOME/.cache/.bash_history";
historyFileSize = 100000; # default
historySize = 10000; # default
historyControl = [
"erasedups"
"ignorespace"
];
historyIgnore = [
"ls"
"exit"
"logout"
];
shellOptions = [
"histappend"
"checkwinsize"
"extglob"
"globstar"
"checkjobs"
"autocd"
"cdspell"
"dirspell"
"dotglob"
];
shellAliases = {
sudo = "sudo ";
frick = "sudo $(fc -ln -1)";
nivm = "nvim";
nivim = "nvim";
tmux = "tmux -2";
ls = "ls -lah --color=auto";
cp = "cp -r";
chore = "(cd ~/.nix/nixos; git add flake.lock; git commit -m 'chore: update flake.lock'; git push)";
tup = "tailscale up --login-server https://headscale.nelim.org";
pc = "mosh matt@10.0.0.248 -- tmux -2u new -At laptop";
oksys = "mosh matt@10.0.0.213 -- tmux -2u new -At laptop";
pve = "mosh matt@10.0.0.121 -- tmux -2u new -At laptop";
mc = "mosh mc@10.0.0.124 -- tmux -2u new -At laptop";
pod = "mosh matt@10.0.0.121 -- ssh -t -p 6768 matt@10.0.0.122 'tmux -2u new -At laptop'";
jelly = "mosh matt@10.0.0.121 -- ssh -t matt@10.0.0.123 'tmux -2u new -At laptop'";
qbit = "mosh matt@10.0.0.121 -- ssh -t matt@10.0.0.128 'tmux -2u new -At laptop'";
};
sessionVariables = { # see configuration.nix
}; };
profileExtra = '' bash = {
export POKE=true enable = true;
[[ -f ~/.bashrc ]] && . ~/.bashrc enableCompletion = true;
'';
bashrcExtra = ''
${lib.strings.fileContents ./config/dracula/less.sh}
${lib.strings.fileContents ./config/dracula/fzf.sh}
${lib.strings.fileContents ./config/colorgrid.sh} historyFile = "\$HOME/.cache/.bash_history";
${lib.strings.fileContents ./config/bashrc} historyFileSize = 100000; # default
''; historySize = 10000; # default
#initExtra = '' historyControl = [
#''; "erasedups"
#logoutExtra = '' "ignorespace"
#''; ];
historyIgnore = [
"ls"
"exit"
"logout"
];
shellOptions = [
"histappend"
"checkwinsize"
"extglob"
"globstar"
"checkjobs"
"autocd"
"cdspell"
"dirspell"
"dotglob"
];
shellAliases = {
sudo = "sudo ";
frick = "sudo $(fc -ln -1)";
nivm = "nvim";
nivim = "nvim";
tmux = "tmux -2";
ls = "ls -lah --color=auto";
cp = "cp -r";
chore = "(cd ~/.nix/nixos; git add flake.lock; git commit -m 'chore: update flake.lock'; git push)";
tup = "tailscale up --login-server https://headscale.nelim.org";
pc = "mosh matt@10.0.0.248 -- tmux -2u new -At laptop";
oksys = "mosh matt@10.0.0.213 -- tmux -2u new -At laptop";
pve = "mosh matt@10.0.0.121 -- tmux -2u new -At laptop";
mc = "mosh mc@10.0.0.124 -- tmux -2u new -At laptop";
pod = "mosh matt@10.0.0.121 -- ssh -t -p 6768 matt@10.0.0.122 'tmux -2u new -At laptop'";
jelly = "mosh matt@10.0.0.121 -- ssh -t matt@10.0.0.123 'tmux -2u new -At laptop'";
qbit = "mosh matt@10.0.0.121 -- ssh -t matt@10.0.0.128 'tmux -2u new -At laptop'";
};
sessionVariables = { # see configuration.nix
};
profileExtra = ''
export POKE=true
[[ -f ~/.bashrc ]] && . ~/.bashrc
'';
bashrcExtra = ''
${lib.strings.fileContents ./config/dracula/less.sh}
${lib.strings.fileContents ./config/dracula/fzf.sh}
${lib.strings.fileContents ./config/colorgrid.sh}
${lib.strings.fileContents ./config/bashrc}
'';
#initExtra = ''
#'';
#logoutExtra = ''
#'';
};
}; };
} }

View file

@ -18,101 +18,109 @@ in
''; '';
}; };
programs.neovim = { programs = {
enable = true;
viAlias = true;
vimAlias = true;
package = pkgs.neovim-nightly;
extraConfig = builtins.concatStringsSep "\n" [ java = {
(lib.strings.fileContents ./config/base.vim)
''
lua << EOF
${lib.strings.fileContents ./config/config.lua}
EOF
''
];
extraPackages = with pkgs; [
tree-sitter
nodejs_latest
gradle
bat
python311Packages.pylint
nil
];
coc = {
enable = true; enable = true;
settings = { package = pkgs.temurin-bin-17;
"colors.enable" = true; };
"coc.preferences.formatOnType" = true;
"Lua.misc.parameters" = [ neovim = {
"--metapath" enable = true;
"~/.cache/sumneko_lua/meta" viAlias = true;
"--logpath" vimAlias = true;
"~/.cache/sumneko_lua/log" package = pkgs.neovim-nightly;
];
"Lua.workspace.library" = [ extraConfig = builtins.concatStringsSep "\n" [
"$\{3rd\}/luv/library" (lib.strings.fileContents ./config/base.vim)
]; ''
sumneko-lua = { lua << EOF
serverDir = "${pkgs.lua-language-server}/share/lua-language-server"; ${lib.strings.fileContents ./config/config.lua}
enableNvimLuaDev = true; EOF
}; ''
"java.jdt.ls.java.home" = "${pkgs.temurin-bin-17}"; ];
"bashIde.shellcheckPath" = "${pkgs.shellcheck}/bin/shellcheck";
languageserver = { extraPackages = with pkgs; [
nix = { tree-sitter
command = "nil"; nodejs_latest
filetypes = [ "nix" ]; gradle
rootPatterns = [ "flake.nix" ]; bat
python311Packages.pylint
nil
];
coc = {
enable = true;
settings = {
"colors.enable" = true;
"coc.preferences.formatOnType" = true;
"Lua.misc.parameters" = [
"--metapath"
"~/.cache/sumneko_lua/meta"
"--logpath"
"~/.cache/sumneko_lua/log"
];
"Lua.workspace.library" = [
"$\{3rd\}/luv/library"
];
sumneko-lua = {
serverDir = "${pkgs.lua-language-server}/share/lua-language-server";
enableNvimLuaDev = true;
};
"java.jdt.ls.java.home" = "${pkgs.temurin-bin-17}";
"bashIde.shellcheckPath" = "${pkgs.shellcheck}/bin/shellcheck";
languageserver = {
nix = {
command = "nil";
filetypes = [ "nix" ];
rootPatterns = [ "flake.nix" ];
};
}; };
}; };
}; };
plugins = with pkgs.vimPlugins; [
vim-which-key
coc-java
coc-css
coc-sumneko-lua
coc-highlight
coc-json
coc-pyright
coc-sh
coc-snippets
coc-vimlsp
coc-yaml
coc-toml
coc-markdownlint
coc-tsserver
neodev-nvim
coc-fzf
fzfWrapper
fzf-vim
nvim-treesitter.withAllGrammars
nvim-treesitter
nvim-autopairs
dracula-nvim
(plugin "lukas-reineke"
"indent-blankline.nvim"
"0fe34b4c1b926e106d105d3ae88ef6cbf6743572"
"sha256-e8gn4pJYALaQ6sGA66SFf8p6VLJBPxT/BimQhOd5eBs=")
gitsigns-nvim
lualine-nvim
minimap-vim
neo-tree-nvim
# to explore more
fugitive
todo-comments-nvim
];
}; };
plugins = with pkgs.vimPlugins; [
vim-which-key
coc-java
coc-css
coc-sumneko-lua
coc-highlight
coc-json
coc-pyright
coc-sh
coc-snippets
coc-vimlsp
coc-yaml
coc-toml
coc-markdownlint
coc-tsserver
neodev-nvim
coc-fzf
fzfWrapper
fzf-vim
nvim-treesitter.withAllGrammars
nvim-treesitter
nvim-autopairs
dracula-nvim
(plugin "lukas-reineke"
"indent-blankline.nvim"
"0fe34b4c1b926e106d105d3ae88ef6cbf6743572"
"sha256-e8gn4pJYALaQ6sGA66SFf8p6VLJBPxT/BimQhOd5eBs=")
gitsigns-nvim
lualine-nvim
minimap-vim
neo-tree-nvim
# to explore more
fugitive
todo-comments-nvim
];
}; };
} }

View file

@ -30,10 +30,6 @@ in
}; };
programs = { programs = {
fzf = {
enable = true;
enableBashIntegration = true;
};
wofi = { wofi = {
enable = true; enable = true;

View file

@ -12,17 +12,6 @@ in
}; };
btop.enable = true; btop.enable = true;
jq.enable = true;
ripgrep = {
enable = true;
};
java = {
enable = true;
package = pkgs.temurin-bin-17;
};
}; };
home.packages = [ home.packages = [