nixos/home/default.nix

253 lines
7 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, tokyonight-folke, ... }:
{
xdg.configFile."bat/themes/tokyonight_night.tmTheme".source =
"${tokyonight-folke}/extras/sublime/tokyonight_night.tmTheme";
programs = {
bash.enable = true;
readline = {
enable = true;
includeSystemConfig = true;
extraConfig = ''
set completion-ignore-case On
'';
};
direnv = {
enable = true;
nix-direnv.enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
fzf = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
bat.enable = true;
git = {
enable = true;
package = pkgs.gitFull;
userName = "Evie Litherland-Smith";
userEmail = lib.mkDefault "evie@xenia.me.uk";
delta = {
enable = true;
options = {
line-numbers = true;
hyprlinks = true;
navigate = true;
side-by-side = true;
syntax-theme = "base16-stylix";
};
};
extraConfig = {
pull.rebase = false;
init.defaultBranch = "main";
merge.conflictstyle = "diff3";
diff.colorMoved = "default";
credential.helper = "${pkgs.gitFull}/bin/git-credential-libsecret";
};
};
ssh = {
enable = true;
forwardAgent = true;
serverAliveInterval = 15;
serverAliveCountMax = 3;
controlMaster = "auto";
controlPersist = "10s";
extraConfig = ''
AddKeysToAgent=yes
SetEnv TERM=xterm-256color
'';
matchBlocks = {
"git*".user = "git";
"legion" = {
user = "xenia";
hostname = "192.168.1.230";
};
"ionos" = {
user = "root";
hostname = "77.68.67.133";
};
"freia" = {
user = "elitherl";
hostname = "freia020.hpc.l";
compression = true;
localForwards = [{
bind.port = 6702;
host = {
address = "127.0.0.1";
port = 6702;
};
}];
};
};
};
starship = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
settings = {
command_timeout = 1000;
add_newline = true;
character = {
success_symbol = "[](bold green)";
error_symbol = "[](bold red)";
};
directory = {
truncation_length = 2;
fish_style_pwd_dir_length = 1;
read_only = " 󰉐";
truncate_to_repo = false;
};
line_break.disabled = false;
git_branch = {
symbol = " ";
only_attached = true;
ignore_branches = [ "master" "main" ];
};
git_commit = {
format = "[󰜘 $hash | $tag]($style) ";
tag_symbol = "󰓹 ";
tag_disabled = false;
};
git_metrics.disabled = false;
hostname = {
ssh_only = true;
ssh_symbol = "󰢹 ";
};
localip.disabled = false;
memory_usage = {
disabled = false;
symbol = "󰍛 ";
};
nix_shell.symbol = "󱄅 ";
os = {
disabled = false;
format = "on [$symbol $name ]($style)";
style = "bold blue";
symbols = {
Alpine = " ";
Android = " ";
Arch = " ";
CentOS = " ";
Debian = " ";
EndeavourOS = " ";
Fedora = " ";
FreeBSD = " ";
Gentoo = " ";
Illumos = " ";
Linux = " ";
Macos = " ";
Manjaro = " ";
Mint = "󰣭 ";
NixOS = " ";
OpenBSD = " ";
openSUSE = " ";
Pop = " ";
Raspbian = " ";
Redhat = " ";
RedHatEnterprise = " ";
Solus = " ";
SUSE = " ";
Ubuntu = " ";
Unknown = " ";
Windows = " ";
};
};
python = {
symbol = "󰌠 ";
python_binary = "python3";
};
rust = { symbol = "󱘗 "; };
shell = {
disabled = false;
format = "using [$indicator ]($style)";
};
sudo = {
disabled = false;
symbol = "󰪋 ";
};
};
};
tmux = {
enable = true;
baseIndex = 1;
clock24 = true;
keyMode = "emacs";
mouse = true;
secureSocket = true;
sensibleOnTop = true;
shortcut = "Space";
terminal = "xterm-256color";
plugins = with pkgs.tmuxPlugins; [ yank tmux-fzf ];
extraConfig = ''
# https://old.reddit.com/r/tmux/comments/mesrci/tmux_2_doesnt_seem_to_use_256_colors/
set -ga terminal-overrides ",*256col*,alacritty:Tc"
set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
set-environment -g COLORTERM "truecolor"
# easy-to-remember split pane commands
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
'';
};
zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
enableVteIntegration = true;
autocd = true;
dotDir = ".config/zsh";
historySubstringSearch.enable = true;
history.path = "${config.xdg.dataHome}/zsh/history";
initExtra = ''
xdg-query-program () {
FILETYPE=$(xdg-mime query filetype $@)
DEFAULT=$(xdg-mime query default $FILETYPE)
echo "$FILETYPE -> $DEFAULT"
}
rsync-local-config () {
HOST=$1
2023-10-20 17:00:23 +01:00
for TARGET in bat git doom starship.toml; do
SOURCE="${config.xdg.configHome}/$TARGET"
TMP_TARGET=/tmp/config-$TARGET
TMP_SOURCE=$TMP_TARGET
NIX_SED="${pkgs.gnused}/bin/sed -i 's|/nix/.*/bin/||g'"
NIX_REPLACE="$NIX_SED $TMP_TARGET"
if [[ -e ${config.xdg.configHome}/$TARGET ]]; then
if [[ -d $SOURCE ]]; then
SOURCE=$SOURCE/
TMP_SOURCE=$TMP_SOURCE/
NIX_REPLACE="${pkgs.fd}/bin/fd -g '**' $TMP_TARGET -tfile -x $NIX_SED {};"
fi
${pkgs.rsync}/bin/rsync -avzL $SOURCE /tmp/config-$TARGET
${pkgs.bash}/bin/sh -c "$NIX_REPLACE"
${pkgs.rsync}/bin/rsync -avzL $TMP_SOURCE $HOST:.config/$TARGET
${pkgs.coreutils}/bin/rm -rf $TMP_SOURCE
fi
done
}
'';
oh-my-zsh = {
enable = true;
plugins = [
# Productivity
"aliases"
"colored-man-pages"
"command-not-found"
"extract"
# Build tools
"git"
"gitignore"
# Misc
"lol"
"rand-quote"
];
theme = "";
};
};
};
}