FEAT: switched to fish shell

This commit is contained in:
Patrick Großmann 2023-02-07 21:37:02 +01:00
parent b050c7d5ec
commit 0cab3c28db
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
12 changed files with 200 additions and 117 deletions

View file

@ -41,6 +41,8 @@
networking.useNetworkd = true;
networking.dhcpcd.enable = false;
# Should remain enabled since nscd from glibc is kinda ass
services.nscd.enableNsncd = true;
systemd.network.wait-online.anyInterface = true;
services.resolved = {
enable = true;
@ -60,8 +62,6 @@
packages = with pkgs; [terminus_font];
useXkbConfig = true; # use xkbOptions in tty.
};
# fix for Editor = nano
programs.zsh.enable = true;
# Configure keymap in X11
services.xserver = {
@ -98,7 +98,7 @@
createHome = true;
extraGroups = ["wheel" "audio" "video" "input"];
group = "patrick";
shell = pkgs.zsh;
shell = pkgs.fish;
passwordFile = config.rekey.secrets.patrick.path;
};
users.groups.patrick.gid = 1000;
@ -109,7 +109,7 @@
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDZixkix0KfKuq7Q19whS5FQQg51/AJGB5BiNF/7h/LM"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHxD4GOrwrBTG4/qQhm5hoSB2CP7W9g1LPWP11oLGOjQ"
];
shell = pkgs.zsh;
shell = pkgs.fish;
passwordFile = config.rekey.secrets.root.path;
};
@ -124,6 +124,7 @@
tree
age-plugin-yubikey
rage
file
];
# List services that you want to enable:

View file

@ -427,89 +427,7 @@ function zshaddhistory() {
[[ ! $1 =~ "$HISTORY_IGNORE_REGEX" ]]
}
# Start ssh-agent if not already running
# if ! pgrep -c -u "$USER" ssh-agent &>/dev/null; then
# ssh-agent -t 4h -s | grep -Fv 'echo' > ~/.ssh/ssh-agent-env \
# && source ~/.ssh/ssh-agent-env
# elif [[ -e ~/.ssh/ssh-agent-env ]]; then
# source ~/.ssh/ssh-agent-env
# else
# echo "error: could not start 'ssh-agent'" >&2
# fi
# Aliases
alias l="ls -lahF --group-directories-first --show-control-chars --quoting-style=escape --color=auto"
alias ll="ls -lahF --group-directories-first --show-control-chars --quoting-style=escape --color=auto"
alias t="tree -F --dirsfirst -L 2"
alias tt="tree -F --dirsfirst -L 3 --filelimit 16"
alias ttt="tree -F --dirsfirst -L 6 --filelimit 16"
alias md="mkdir"
alias rmd="rm -d"
#because 2 less keys is still only half the work
alias ta="task"
alias tat="taskwarrior-tui"
#what the fuck is going on here????
alias cpr="rsync -axHAWXS --numeric-ids --info=progress2"
alias cp="cp -vi"
alias mv="mv -vi"
alias rm="rm -I"
alias chmod="chmod -c --preserve-root"
alias chown="chown -c --preserve-root"
alias -s {md,txt,cpp,hpp,h,c}=vim
alias ip="ip --color"
alias tmux="tmux -2"
alias rg="rg -S"
#tar any number of given filen and compress them
alias comptar="tar -c -f archive.tar.xz -v -I 'pixz -9'"
#random functions
#compress all files in current directory excluding folders and already compressed files
function compressAll() {
for i in $(ls -p | grep -E -v "/|(.xz|.gz|.zip)")
do
echo "compressing: " $i
pixz -9 $i
done
}
#extract random file
function ex () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.tar.xz) tar xfJ $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# Aliases when X is running
if xset q &>/dev/null; then
alias zf="zathura --fork" #pdf viewer
fi
alias vi="nvim"
alias vim="nvim"
# Set umask
umask 077
alias luamake=/home/patrick/.local/share/nvim/lua-language-server/3rd/luamake/luamake

View file

@ -81,11 +81,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1675545634,
"narHash": "sha256-TbQeQcM5TA/wIho6xtzG+inUfiGzUXi8ewwttiQWYJE=",
"lastModified": 1675673983,
"narHash": "sha256-8hzNh1jtiPxL5r3ICNzSmpSzV7kGb3KwX+FS5BWJUTo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0591d6b57bfeb55dfeec99a671843337bc2c3323",
"rev": "5a350a8f31bb7ef0c6e79aea3795a890cf7743d4",
"type": "github"
},
"original": {

View file

@ -52,6 +52,5 @@
Only use yubikeys or password encrypted age keys
'';
};
};
}

28
users/common/alias.nix Normal file
View file

@ -0,0 +1,28 @@
{...}: {
home.shellAliases = {
# Aliases
l = "ls -lahF --group-directories-first --show-control-chars --quoting-style=escape --color=auto";
ll = "ls -lahF --group-directories-first --show-control-chars --quoting-style=escape --color=auto";
t = "tree -F --dirsfirst -L 2";
tt = "tree -F --dirsfirst -L 3 --filelimit 16";
ttt = "tree -F --dirsfirst -L 6 --filelimit 16";
md = "mkdir";
rmd = "rm -d";
#what the fuck is going on here????
cpr = "rsync -axHAWXS --numeric-ids --info=progress2";
cp = "cp -vi";
mv = "mv -vi";
rm = "rm -I";
chmod = "chmod -c --preserve-root";
chown = "chown -c --preserve-root";
ip = "ip --color";
tmux = "tmux -2";
rg = "rg -S";
zf = "zathura --fork";
};
}

View file

@ -4,8 +4,10 @@
...
}: {
imports = [
./zsh.nix
#./zsh.nix
./fish.nix
./htop.nix
./alias.nix
];
home.packages = with pkgs; [

132
users/common/fish.nix Normal file
View file

@ -0,0 +1,132 @@
{
config,
pkgs,
lib,
...
}: {
programs.atuin = {
enable = true;
settings.auto_sync = false;
};
programs.starship = {
enable = true;
settings = {
add_newline = false;
format = lib.concatStrings [
"$username"
"$hostname"
" $directory"
"$git_branch"
"$git_commit"
"$git_state"
"$git_status"
"$nix_shell"
"$character"
];
right_format = lib.concatStrings [
"$cmd_duration"
"$status"
"$jobs"
"$time"
];
username = {
style_user = "yellow";
style_root = "bold red";
show_always = true;
format = "[$user]($style)";
};
hostname = {
style = "red";
format = "@[$hostname]($style)";
};
directory = {
format = "[$path]($style)[$read_only]($read_only_style) ";
fish_style_pwd_dir_length = 1;
truncate_to_repo = false;
};
git_branch = {
format = "[$symbol$branch(:$remote_branch)]($style)";
};
git_status = {
conflicted = "$count";
ahead = "$count";
behind = "$count";
diverged = "$ahead_count$behind_count";
untracked = "?$count";
stashed = "\\$$count";
modified = "!$count";
staged = "+$count";
renamed = "$count";
deleted = "-$count";
format = lib.concatStrings [
"[( $conflicted)](red)"
"[( $stashed)](magenta)"
"[( $staged)](green)"
"[( $deleted)](red)"
"[( $renamed)](blue)"
"[( $modified)](yellow)"
"[( $untracked)](blue)"
"[( $ahead_behind)](green)"
];
};
nix_shell = {
heuristic = true;
};
cmd_duration = {
format = "[ $duration]($style) ";
style = "yellow";
};
status = {
disabled = false;
pipestatus = true;
style = "red";
pipestatus_format = "$pipestatus -> [$int( $signal_name)]($style)";
pipestatus_separator = "[ | ]($style)";
pipestatus_segment_format = "[$status]($style)";
format = "[$status( $signal_name)]($style) ";
};
time = {
disabled = false;
format = "[ $time]($style)";
style = "yellow";
};
};
};
programs.fish = with lib; {
enable = true;
interactiveShellInit = lib.mkMerge [
(lib.mkBefore ''
set -g ATUIN_NOBIND true
set -g fish_greeting
set -g fish_autosuggestion_enabled 0
set -U FZF_COMPLETE 2
'')
(lib.mkAfter ''
bind \cr _atuin_search
'')
];
plugins = [
{
name = "fzf";
src = pkgs.fetchFromGitHub {
owner = "jethrokuan";
repo = "fzf";
rev = "479fa67d7439b23095e01b64987ae79a91a4e283";
sha256 = "0k6l21j192hrhy95092dm8029p52aakvzis7jiw48wnbckyidi6v";
};
}
];
};
}

View file

@ -40,8 +40,8 @@
color12 = "#61afef";
color5 = " #9378de";
color13 = "#c678dd";
color6 = " #cc9c66";
color14 = "#e5ab69";
color6 = " #56b6c2";
color14 = "#56b6c2";
color7 = " #979eab";
color15 = "#abb2bf";

View file

@ -8,9 +8,11 @@
# a = "lel"
# a-b = "lul"
# 2. polybar allows integer keys. In nix these have to be quoted
{lib, pkgs, ...}: let
{
lib,
pkgs,
...
}: let
color = {
shade1 = "#311B92";
shade2 = "#4527A0";
@ -119,7 +121,6 @@ in {
label-empty-foreground = "#707880";
};
"module/workspaces" = {
type = "internal/xworkspaces";
@ -265,7 +266,6 @@ in {
format.disconnected-background = color.shade3;
format.disconnected-foreground = color.modulefg;
format.disconnected-padding = "1";
};
"module/keyboardswitcher" = {

View file

@ -3,7 +3,11 @@
home-manager,
...
}: {
home-manager.users.patrick.imports = [./patrick.nix];
home-manager.users.patrick.imports = [
./patrick.nix
./common
];
home-manager.users.root = {
imports = [./common];
home.stateVersion = "23.05";

View file

@ -9,7 +9,6 @@
common/autorandr.nix
common/desktop.nix
common/polybar.nix
./common
];
home = {