mirror of
https://github.com/kossLAN/zsh-flake.git
synced 2025-11-05 02:09:49 -05:00
Add zsh flake
This commit is contained in:
parent
74c9b5a49f
commit
ec2df57d71
5 changed files with 169 additions and 0 deletions
54
nix/config.nix
Normal file
54
nix/config.nix
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# This is where personal configuration is expected to be, I'll probably add more, but for the moment this
|
||||
# will do.
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
oh-my-zsh = pkgs.fetchFromGitHub {
|
||||
owner = "ohmyzsh";
|
||||
repo = "ohmyzsh";
|
||||
rev = "fd01fd66ce27c669e5ffaea94460a37423d1e134";
|
||||
sha256 = "sha256-5G96Iae543/CVmwRVpwAlbRB7vf+t/E2fl0pOu+RM6Y=";
|
||||
};
|
||||
in {
|
||||
# Whether or not to enable auto suggestions
|
||||
autoSuggestions = true;
|
||||
|
||||
# Additional .zshrc configuration that you can add that will be appended to the .zshrc
|
||||
extraZshrc = ''
|
||||
# Movement bindings
|
||||
bindkey -v
|
||||
bindkey "^[[1;5C" forward-word
|
||||
bindkey "^[[1;5D" backward-word
|
||||
'';
|
||||
|
||||
# A list of path's to a plugin
|
||||
plugins = [
|
||||
# The ZSH theme that I use, I think it looks good, go check it out.
|
||||
"${pkgs.fetchFromGitHub {
|
||||
owner = "zthxxx";
|
||||
repo = "jovial";
|
||||
rev = "701ea89b6dd2b9859dab32bd083a16643b338b47";
|
||||
sha256 = "sha256-VVGBG0ZoL25v+Ht1QbnZMc1TqTiJvr211OvyVwNc3bc=";
|
||||
}}/jovial.zsh-theme"
|
||||
|
||||
"${pkgs.fetchFromGitHub {
|
||||
owner = "zthxxx";
|
||||
repo = "zsh-history-enquirer";
|
||||
rev = "6fdfedc4e581740e7db388b36b5e66f7c86e8046";
|
||||
sha256 = "sha256-/RGBIoieqexK2r4onFbXAt4ALEIb17mn/all0P1xFkE=";
|
||||
}}/zsh-history-enquirer.plugin.zsh"
|
||||
|
||||
"${pkgs.fetchFromGitHub {
|
||||
owner = "zsh-users";
|
||||
repo = "zsh-syntax-highlighting";
|
||||
rev = "e0165eaa730dd0fa321a6a6de74f092fe87630b0";
|
||||
sha256 = "sha256-4rW2N+ankAH4sA6Sa5mr9IKsdAg7WTgrmyqJ2V1vygQ=";
|
||||
}}/zsh-syntax-highlighting.zsh"
|
||||
|
||||
"${oh-my-zsh}/plugins/git/git.plugin.zsh"
|
||||
"${oh-my-zsh}/plugins/urltools/urltools.plugin.zsh"
|
||||
"${oh-my-zsh}/plugins/bgnotify/bgnotify.plugin.zsh"
|
||||
];
|
||||
}
|
||||
62
nix/wrapZsh.nix
Normal file
62
nix/wrapZsh.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
conf = import ./config.nix {inherit pkgs lib;};
|
||||
in
|
||||
pkgs.symlinkJoin {
|
||||
name = "zsh";
|
||||
paths = [pkgs.zsh];
|
||||
buildInputs = [pkgs.makeWrapper];
|
||||
postBuild = ''
|
||||
# When it comes to zsh options, I'm probably missing some important ones,
|
||||
# if you know of any that I should add please make an issue for me, thank you.
|
||||
# The sh comment before the multiline is for syntax highlighting in neovim.
|
||||
mkdir -p $out/etc/zsh
|
||||
cp ${pkgs.writeText "zshrc" #sh
|
||||
|
||||
''
|
||||
# Auto suggestions
|
||||
${
|
||||
if conf.autoSuggestions
|
||||
then ''
|
||||
source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
ZSH_AUTOSUGGEST_STRATEGY=(history)
|
||||
''
|
||||
else ""
|
||||
}
|
||||
|
||||
# History configuration
|
||||
HISTFILE="$HOME/.zsh_history"
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
setopt AUTO_CD
|
||||
setopt AUTO_PUSHD
|
||||
setopt PUSHD_IGNORE_DUPS
|
||||
setopt EXTENDED_HISTORY
|
||||
setopt SHARE_HISTORY
|
||||
setopt HIST_EXPIRE_DUPS_FIRST
|
||||
setopt HIST_IGNORE_DUPS
|
||||
setopt HIST_IGNORE_SPACE
|
||||
setopt HIST_VERIFY
|
||||
setopt INTERACTIVE_COMMENTS
|
||||
|
||||
# Basic autocompletion
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
|
||||
# Plugins import
|
||||
${lib.concatMapStrings (plugin: ''
|
||||
if [[ -f "${plugin}" ]]; then
|
||||
source "${plugin}"
|
||||
fi
|
||||
'')
|
||||
conf.plugins}
|
||||
${conf.extraZshrc}
|
||||
''} $out/etc/zsh/.zshrc
|
||||
|
||||
wrapProgram $out/bin/zsh \
|
||||
--set ZDOTDIR "$out/etc/zsh" \
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue