mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
118 lines
3.2 KiB
Nix
118 lines
3.2 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
shellFunAlias = command: replacement: ''
|
|
if [[ ! -t 0 ]]; then
|
|
command ${command} $@
|
|
else
|
|
echo 'use ${replacement}!'
|
|
fi
|
|
'';
|
|
shellFunAliases = mapAttrs shellFunAlias;
|
|
in
|
|
{
|
|
home.shell.functions = {
|
|
genmac = ''
|
|
nix run nixpkgs.openssl -c openssl rand -hex 6 | sed 's/\(..\)\(..\)\(..\)\(..\)\(..\)\(..\)/\1:\2:\3:\4:\5:\6/'
|
|
'';
|
|
nano = ''
|
|
${pkgs.wezterm}/bin/wezterm imgcat ${./nano.png}
|
|
'';
|
|
} // shellFunAliases {
|
|
sed = "sd";
|
|
find = "fd";
|
|
grep = "rg";
|
|
};
|
|
xdg.dataFile = { "z/.keep".text = ""; };
|
|
home.packages = with pkgs; [ fzf fd zsh-completions akiflags ];
|
|
programs.zsh = {
|
|
enable = true;
|
|
enableSyntaxHighlighting = true;
|
|
enableAutosuggestions = true;
|
|
initExtra =
|
|
let
|
|
zshOpts = [
|
|
"auto_pushd"
|
|
"pushd_ignore_dups"
|
|
"pushdminus"
|
|
"rmstarsilent"
|
|
"nonomatch"
|
|
"long_list_jobs"
|
|
"interactivecomments"
|
|
"append_history"
|
|
"hist_ignore_space"
|
|
"hist_verify"
|
|
"inc_append_history"
|
|
"nosharehistory"
|
|
"nomenu_complete"
|
|
"auto_menu"
|
|
"no_auto_remove_slash"
|
|
"complete_in_word"
|
|
"always_to_end"
|
|
"nolistbeep"
|
|
"autolist"
|
|
"listrowsfirst"
|
|
]; in
|
|
''
|
|
ZSH_TAB_TITLE_ADDITIONAL_TERMS='foot'
|
|
ZSH_TAB_TITLE_ENABLE_FULL_COMMAND=true
|
|
zmodload -i zsh/complist
|
|
zstyle ':completion:*' list-colors ""
|
|
zstyle ':completion:*:*:*:*:*' menu select
|
|
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
|
|
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
|
|
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
|
|
zstyle ':completion:*:complete:pass:*:*' matcher 'r:|[./_-]=** r:|=*' 'l:|=* r:|=*'
|
|
${lib.concatStringsSep "\n" (map (opt: "setopt ${opt}") zshOpts)}
|
|
bindkey '^ ' autosuggest-accept
|
|
'';
|
|
shellAliases = {
|
|
nixdirfmt = "fd --color=never .nix | xargs nixpkgs-fmt";
|
|
exa = "exa --time-style long-iso";
|
|
ls = "exa -G";
|
|
la = "exa -Ga";
|
|
ll = "exa -l";
|
|
lla = "exa -lga";
|
|
sys = "systemctl";
|
|
log = "journalctl";
|
|
dmesg = "dmesg -HP";
|
|
lg = "log --no-pager | grep";
|
|
hg = "history 0 | grep";
|
|
};
|
|
localVariables = {
|
|
_Z_DATA = "${config.xdg.dataHome}/z/data";
|
|
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=3,bold";
|
|
ZSH_AUTOSUGGEST_USE_ASYNC = 1;
|
|
};
|
|
plugins = with pkgs.zsh-plugins; (map (plugin: plugin.zshPlugin) [
|
|
tab-title
|
|
vim-mode
|
|
evil-registers
|
|
]) ++ (map
|
|
(plugin: (with pkgs.${plugin}; {
|
|
name = pname;
|
|
inherit src;
|
|
})) [
|
|
"zsh-z"
|
|
]) ++ [
|
|
(with pkgs.zsh-fzf-tab; {
|
|
name = "fzf-tab";
|
|
inherit src;
|
|
})
|
|
];
|
|
};
|
|
programs.fzf = {
|
|
enable = true;
|
|
enableZshIntegration = true;
|
|
};
|
|
programs.starship = {
|
|
enable = true;
|
|
enableZshIntegration = true;
|
|
};
|
|
programs.direnv = {
|
|
enable = true;
|
|
enableZshIntegration = true;
|
|
};
|
|
}
|