145 lines
3.8 KiB
Nix
145 lines
3.8 KiB
Nix
{ self, inputs, ... }:
|
|
let
|
|
username = "john";
|
|
historySize = 10000;
|
|
homeEndKeyBindings = ''
|
|
# Normalize common Home/End escape sequences across terminal emulators.
|
|
bindkey "^[[H" beginning-of-line
|
|
bindkey "^[[F" end-of-line
|
|
bindkey "^[[1~" beginning-of-line
|
|
bindkey "^[[4~" end-of-line
|
|
bindkey "^[[7~" beginning-of-line
|
|
bindkey "^[[8~" end-of-line
|
|
bindkey "^[OH" beginning-of-line
|
|
bindkey "^[OF" end-of-line
|
|
bindkey "^[[3~" delete-char
|
|
|
|
# Normalize common Ctrl+Arrow sequences for word-wise movement.
|
|
bindkey "^[[1;5D" backward-word
|
|
bindkey "^[[1;5C" forward-word
|
|
bindkey "^[[5D" backward-word
|
|
bindkey "^[[5C" forward-word
|
|
'';
|
|
in
|
|
{
|
|
flake.modules = {
|
|
nixos.zsh = { pkgs, ... }: {
|
|
users.users."${username}".shell = pkgs.zsh;
|
|
programs.zsh.enable = true;
|
|
# Already being imported by the john.nix module
|
|
# home-manager.sharedModules = [
|
|
# inputs.self.modules.homeManager.zsh
|
|
# ];
|
|
};
|
|
|
|
homeManager.zsh = { pkgs, config, ... }: {
|
|
programs.zsh = {
|
|
enable = true;
|
|
package = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.jsl-zsh;
|
|
enableCompletion = true;
|
|
autosuggestion.enable = true;
|
|
# syntaxHighlighting.enable = true;
|
|
initContent = ''
|
|
HOST=$(hostname -s)
|
|
${homeEndKeyBindings}
|
|
'';
|
|
dotDir = "${config.xdg.configHome}/zsh";
|
|
history = {
|
|
append = true;
|
|
ignoreAllDups = true;
|
|
ignorePatterns = [
|
|
"history"
|
|
"ls"
|
|
"eza"
|
|
"clear"
|
|
];
|
|
save = historySize;
|
|
size = historySize;
|
|
share = true;
|
|
};
|
|
oh-my-zsh = {
|
|
enable = true;
|
|
# theme = "risto";
|
|
theme = "agnoster";
|
|
plugins = [
|
|
"sudo"
|
|
"dotenv"
|
|
"git"
|
|
"ssh"
|
|
"ssh-agent"
|
|
];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
perSystem = { config, self', pkgs, lib, ... }: {
|
|
packages.jsl-zsh =
|
|
let
|
|
ignorePatterns = [
|
|
"ls" "eza" "history" "clear"
|
|
];
|
|
aliasStr = lib.concatStringsSep "\n" (
|
|
lib.mapAttrsToList (k: v: "alias -- ${lib.escapeShellArg k}=${lib.escapeShellArg v}") {
|
|
ls = "eza";
|
|
ll = "eza -l";
|
|
la = "eza -a";
|
|
lt = "eza --tree";
|
|
lla = "eza -la";
|
|
ds = "gdu -i /snap /";
|
|
ld = "lazydocker";
|
|
});
|
|
in
|
|
(inputs.wrappers.wrapperModules.zsh.apply {
|
|
inherit pkgs;
|
|
binName = "jsl-zsh";
|
|
env = {
|
|
LANG = "en_US.UTF-8";
|
|
COLORTERM = "truecolor";
|
|
};
|
|
settings = {
|
|
completion = {
|
|
enable = true;
|
|
extraCompletions = true;
|
|
caseInsensitive = true;
|
|
fuzzySearch = true;
|
|
};
|
|
autoSuggestions = {
|
|
enable = true;
|
|
strategy = [ "history" "completion" ];
|
|
};
|
|
history = {
|
|
append = true;
|
|
expanded = true;
|
|
share = true;
|
|
ignoreAllDups = true;
|
|
ignoreSpace = true;
|
|
};
|
|
integrations = {
|
|
fzf.enable = true;
|
|
starship = {
|
|
enable = true;
|
|
package = self'.packages.starship;
|
|
};
|
|
zoxide.enable = true;
|
|
};
|
|
};
|
|
extraRC = ''
|
|
${homeEndKeyBindings}
|
|
|
|
HISTFILE=$HOME/.config/zsh/.zsh_history
|
|
SAVEHIST=${toString historySize}
|
|
HISTORY_IGNORE=${lib.escapeShellArg "(${lib.concatStringsSep "|" ignorePatterns})"}
|
|
|
|
HOSTNAME=$(hostname -s)
|
|
${aliasStr}
|
|
'';
|
|
extraPackages = with pkgs; [
|
|
lazydocker
|
|
self'.packages.shell-tools
|
|
self'.packages.neovim-min
|
|
];
|
|
}).wrapper;
|
|
};
|
|
}
|