Configure zsh part 1

This commit is contained in:
2023-02-18 02:00:05 +09:00
parent 2f57c05a20
commit c6d679b6a3
6 changed files with 3377 additions and 0 deletions
+7
View File
@@ -55,6 +55,7 @@
users.users.${user} = {
isNormalUser = true;
extraGroups = ["wheel" "input"];
shell = pkgs.zsh;
packages = with pkgs; [
git
];
@@ -85,6 +86,11 @@
hyprland.nixosModules.default
{programs.hyprland.enable = true;}
({pkgs, ...}: {
programs.zsh.enable = true;
environment.shells = with pkgs; [zsh];
})
xremap.nixosModules.default
{
services.xremap = {
@@ -117,6 +123,7 @@
eww.enable = true;
rofi.enable = true;
apps.enable = true;
zsh.enable = true;
};
};
};
+1
View File
@@ -4,6 +4,7 @@
./eww
./rofi
./apps
./zsh
];
home.stateVersion = "22.11";
+8
View File
@@ -0,0 +1,8 @@
push()
{
if [[ -z "$1" ]]; then
git push
return
fi
git add -A && git commit -m "$*" && git push
}
+90
View File
@@ -0,0 +1,90 @@
{
pkgs,
config,
lib,
...
}: let
cfg = config.modules.zsh;
configThemeNormal = ./p10k.zsh;
configThemeTTY = ./p10k-tty.zsh;
in {
options.modules.zsh = {enable = lib.mkEnableOption "zsh";};
config = lib.mkIf cfg.enable {
programs.exa.enable = true;
programs.zsh = {
enable = true;
autocd = true;
enableAutosuggestions = true;
enableCompletion = true;
enableSyntaxHighlighting = true;
dotDir = ".config/zsh";
shellAliases = {
# ls/exa stuff
l = "ls -l";
ll = "ls -l";
la = "ls -la";
lla = "ls -la";
lc = "l --color";
exa = "exa --group";
lg = "exa -l --git-ignore";
ls = "exa";
lt = "exa --tree";
tree = "exa --tree";
# Misc
s = "git status";
op = "xdg-open";
py = "nix-shell -p python3";
jctl = "sudo journalctl -n 1000 -fu";
};
plugins = [
{
name = "powerlevel10k";
src = pkgs.zsh-powerlevel10k;
file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
}
{
name = "custom";
src = ./custom.zsh;
}
];
initExtra = ''
# The powerlevel theme I'm using is distgusting in TTY, let's default
# to something else
# See https://github.com/romkatv/powerlevel10k/issues/325
# Instead of sourcing this file you could also add another plugin as
# this, and it will automatically load the file for us
# (but this way it is not possible to conditionally load a file)
# {
# name = "powerlevel10k-config";
# src = lib.cleanSource ./p10k-config;
# file = "p10k.zsh";
# }
if zmodload zsh/terminfo && (( terminfo[colors] >= 256 )); then
[[ ! -f ${configThemeNormal} ]] || source ${configThemeNormal}
else
[[ ! -f ${configThemeTTY} ]] || source ${configThemeTTY}
fi
if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then
source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh"
fi
'';
oh-my-zsh = {
enable = true;
plugins = [
"sudo"
"git"
"copypath"
"copyfile"
"jsontools"
"command-not-found"
];
};
};
};
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff