full zsh integration into hm, removed from core nixos module

This commit is contained in:
Anish L 2022-05-22 22:31:45 +10:00
parent 285e319681
commit fb48bf2d8d
3 changed files with 77 additions and 109 deletions

View file

@ -29,91 +29,9 @@ in
''; '';
}; };
#programs.bash = { environment.systemPackages = with pkgs; [
# promptInit = '' pinentry_gnome
# eval "$(starship init bash)" ];
# '';
# interactiveShellInit = ''
# flakify() {
# if [ ! -e flake.nix ]; then
# nix flake new -t github:nix-community/nix-direnv .
# elif [ ! -e .envrc ]; then
# echo "use flake" > .envrc
# direnv allow
# fi
# vim flake.nix
# }
# export STARSHIP_CONFIG=${
# pkgs.writeText "starship.toml"
# (builtins.readFile ./starship.toml)
# }
# eval "$(${pkgs.direnv}/bin/direnv hook bash)"
# '';
# enableCompletion = true;
#};
programs.zsh.enable = true;
environment = {
shellInit = ''
export STARSHIP_CONFIG=${
pkgs.writeText "starship.toml"
(fileContents ./starship.toml)
}
'';
shellAliases =
let ifSudo = lib.mkIf config.security.sudo.enable;
in
{
# nix
n = "nix";
np = "n profile";
ni = "np install";
nr = "np remove";
ns = "n search --no-update-lock-file";
nf = "n flake";
nepl = "n repl '<nixpkgs>'";
srch = "ns nixos";
orch = "ns override";
nrb = ifSudo "cd /tmp; sudo nixos-rebuild switch --flake '/etc/nixos/#curve'; cd $OLDPWD";
nrt = ifSudo "sudo nixos-rebuild test --flake '/etc/nixos/#curve'";
nedit = "cd /etc/nixos; vim";
ncd = "cd /etc/nixos";
mn = ''
manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | sk --preview="manix '{}'" | xargs manix
'';
# fix nixos-option
nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat";
# sudo
s = ifSudo "sudo -E ";
pls = ifSudo "s";
si = ifSudo "sudo -i";
se = ifSudo "sudoedit";
# top
top = "btm";
# systemd
ctl = "systemctl";
stl = ifSudo "s systemctl";
utl = "systemctl --user";
ut = "systemctl --user start";
un = "systemctl --user stop";
up = ifSudo "s systemctl start";
dn = ifSudo "s systemctl stop";
jtl = "journalctl";
# quick ssh
sm = "ssh 10.0.69.4";
ss = "ssh sealight.xyz";
sc = "ssh lakhwara.com"; # cube
};
};
services.devmon.enable = true; services.devmon.enable = true;

View file

@ -52,7 +52,6 @@ in
calibre calibre
nheko nheko
mpv mpv
scrot
newsflash newsflash
zeal zeal
xclip xclip

View file

@ -1,5 +1,4 @@
{ pkgs, config, ... }: { self, lib, pkgs, config, ... }:
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
binutils binutils
@ -45,7 +44,6 @@
tmux tmux
pwgen pwgen
glow glow
pinentry_gnome
pass pass
less less
gdb gdb
@ -55,36 +53,41 @@
gnupg gnupg
syncthing syncthing
dijo dijo
#kdeconnect flameshot
#ssb-patchwork #ssb-patchwork
libreoffice libreoffice
fontconfig fontconfig
pandoc pandoc
]; ];
programs.zsh = {
enable = true;
enableCompletion = true;
enableAutosuggestions = true;
initExtra = ''
flakify() {
if [ ! -e flake.nix ]; then
nix flake new -t github:nix-community/nix-direnv .
elif [ ! -e .envrc ]; then
echo "use flake" > .envrc
direnv allow
fi
vim flake.nix
}
'';
sessionVariables = {
EDITOR = "nvim";
};
};
programs.starship = { programs.starship = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;
}; };
programs.zsh = { programs.fzf = {
enable = true; enable = true;
enableZshIntegration = true;
# interactiveShellInit = ''
# flakify() {
# if [ ! -e flake.nix ]; then
# nix flake new -t github:nix-community/nix-direnv .
# elif [ ! -e .envrc ]; then
# echo "use flake" > .envrc
# direnv allow
# fi
# vim flake.nix
# }
# '';
sessionVariables = {
EDITOR = "nvim";
};
enableCompletion = true;
}; };
programs.direnv = { programs.direnv = {
@ -92,6 +95,8 @@
enableZshIntegration = true; enableZshIntegration = true;
}; };
services.kdeconnect.enable = true;
home.shellAliases = { home.shellAliases = {
# quick cd # quick cd
".." = "cd .."; ".." = "cd ..";
@ -101,7 +106,8 @@
# modern cli tools # modern cli tools
ls = "exa"; ls = "exa";
l = "ls"; l = "exa -l";
la = "exa -la";
tree = "ls --tree"; tree = "ls --tree";
cat = "bat"; cat = "bat";
unzip = "aunpack"; unzip = "aunpack";
@ -115,7 +121,8 @@
te = "task edit"; te = "task edit";
ts = "task sync"; ts = "task sync";
scrot = "scrot ~/screenshots/%b%d::%H%M%S.png"; scrot = "flameshot screen -c -p ~/screenshots/";
scrotgui = "flameshot gui -p ~/screenshots/";
# git # git
g = "git"; g = "git";
@ -126,5 +133,49 @@
# internet ip # internet ip
myip = "dig +short myip.opendns.com @208.67.222.222 2>&1"; myip = "dig +short myip.opendns.com @208.67.222.222 2>&1";
# nix
n = "nix";
np = "n profile";
ni = "np install";
nr = "np remove";
ns = "n search --no-update-lock-file";
nf = "n flake";
nepl = "n repl '<nixpkgs>'";
srch = "ns nixos";
orch = "ns override";
nrb = "cd /tmp; sudo nixos-rebuild switch --flake '/etc/nixos/#curve'; cd $OLDPWD";
nrt = "cd /tmp; sudo nixos-rebuild test --flake '/etc/nixos/#curve'; cd $OLDPWD";
ned = "cd /etc/nixos; vim";
ncd = "cd /etc/nixos";
mn = ''
manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | sk --preview="manix '{}'" | xargs manix
'';
# fix nixos-option
nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat";
# sudo
s = "sudo -E ";
pls = "s";
si = "sudo -i";
se = "sudoedit";
# top
top = "btm";
# systemd
ctl = "systemctl";
stl = "s systemctl";
utl = "systemctl --user";
ut = "systemctl --user start";
un = "systemctl --user stop";
up = "s systemctl start";
dn = "s systemctl stop";
jtl = "journalctl";
# quick ssh
sm = "ssh 10.0.69.4";
ss = "ssh sealight.xyz";
sc = "ssh lakhwara.com"; # cube
}; };
} }