add zshrc

This commit is contained in:
Sam 2024-05-24 20:23:56 +00:00
parent c0575c77ae
commit 2d0c12a033
4 changed files with 94 additions and 1 deletions

View File

@ -17,7 +17,71 @@
bindkey "^H" backward-delete-char bindkey "^H" backward-delete-char
bindkey "^?" backward-delete-char bindkey "^?" backward-delete-char
set -o vi set -o vi
export TERM=xterm export TERM=xterm-256color
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
SESSION_TYPE="(ssh) "
fi
####
# Format prompt
####
# Define colors
COLOR_RED="red"
COLOR_MAGENTA="92"
COLOR_YELLOW="3"
COLOR_GREEN="36"
COLOR_BLUE="4"
COLOR_WHITE="7"
# Format git colors
autoload -Uz compinit && compinit
autoload -Uz add-zsh-hook
autoload -Uz vcs_info
add-zsh-hook precmd vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' formats " %F{cyan}%c%u(%b)%f"
zstyle ':vcs_info:*' actionformats " %F{cyan}%c%u(%b)%f %a"
zstyle ':vcs_info:*' stagedstr "%F{$COLOR_RED}"
zstyle ':vcs_info:*' unstagedstr "%F{$COLOR_RED}"
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:git*+set-message:*' hooks git-untracked
+vi-git-untracked() {
if git --no-optional-locks status --porcelain 2> /dev/null | grep -q "^??"; then
hook_com[staged]+="%F{$COLOR_RED}"
elif git --no-optional-locks status --porcelain 2> /dev/null | grep -q "^A"; then
hook_com[staged]+="%F{$COLOR_YELLOW}"
else
hook_com[staged]+="%F{$COLOR_GREEN}"
fi
}
# Format prompt
setopt PROMPT_SUBST
PROMPT='%F{'$COLOR_GREEN'}'$(echo "$SESSION_TYPE")'''
PROMPT+='%F{'$COLOR_RED'}['
PROMPT+='%F{'$COLOR_GREEN'}%n'
PROMPT+='%F{red}@'
PROMPT+='%F{'$COLOR_YELLOW'}%m'
PROMPT+='%F{'$COLOR_RED'}] '
PROMPT+='%F{'$COLOR_WHITE'}['
PROMPT+='%F{'$COLOR_YELLOW'}%1~'
PROMPT+='%F{'$COLOR_WHITE'}]'
PROMPT+='$'
PROMPT+='vcs_info_msg_0_'
PROMPT+=' > '
export PROMPT
setopt autocd # Automatically cd into typed directory.
stty stop undef # Disable ctrl-s to freeze terminal.
setopt interactive_comments
# General opts
HISTSIZE=10000000
SAVEHIST=10000000
setopt appendhistory
''; '';
}; };
} }

View File

@ -0,0 +1,27 @@
{ config, ... }:
let
user = config.home.username;
in
{
services = {
syncthing = {
enable = true;
# user = "${user}";
# dataDir = "/home/${user}/sync";
# configDir = "/home/${user}/.config/syncthing";
# overrideDevices = true; # overrides any devices added or deleted through the WebUI
# overrideFolders = true; # overrides any folders added or deleted through the WebUI
# settings = {
# devices = {
# "device1" = { id = "UT6263Y-V3GJXNO-6KIGAKZ-KY6UQMD-ER6BT4R-4LPKT2P-V4PCJYZ-ROJZIQQ"; };
# };
# folders = {
# "sync" = { # Name of folder in Syncthing, also the folder ID
# path = "/home/${user}/sync"; # Which folder to add to Syncthing
# devices = [ "device1" ]; # Which devices to share the folder with
# };
# };
# };
};
};
}

View File

@ -14,6 +14,7 @@
# Import optional # Import optional
./common/optional/git.nix ./common/optional/git.nix
./common/optional/syncthing.nix
]; ];
} }

View File

@ -5,6 +5,7 @@ let
sopsHashedPasswordFile = lib.optionalString (lib.hasAttr "sops-nix" inputs) config.sops.secrets."passwords/media".path; sopsHashedPasswordFile = lib.optionalString (lib.hasAttr "sops-nix" inputs) config.sops.secrets."passwords/media".path;
secretsDirectory = builtins.toString inputs.nix-secrets; secretsDirectory = builtins.toString inputs.nix-secrets;
secretsFile = "${secretsDirectory}/secrets.yaml"; secretsFile = "${secretsDirectory}/secrets.yaml";
in in
{ {
users.users.media = { users.users.media = {