Compare commits

...

2 commits

Author SHA1 Message Date
44bb5b5c8c
feat: Convert to module options 2025-04-19 23:58:05 +02:00
github-actions[bot]
3792d15fd0 automated: Update flake.lock
- The following Nix Flake inputs were updated:

```
• Updated input 'nixpkgs':
    'path:/nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source?lastModified=1741010256&narHash=sha256-WZNlK/KX7Sni0RyqLSqLPbK8k08Kq7H7RijPJbq9KHM%3D&rev=ba487dbc9d04e0634c64e3b1f0d25839a0a68246' (2025-03-03)
  → 'github:NixOS/nixpkgs/dd613136ee91f67e5dba3f3f41ac99ae89c5406b?narHash=sha256-RVQQZy38O3Zb8yoRJhuFgWo/iDIDj0hEdRTVfhOtzRk%3D' (2025-03-23)
```

Auto-generated by [update.yml][1] with the help of
[create-pull-request][2].

[1]: https://forgejo.stefka.eu/jiriks74/nix.nvim/src/branch/main/.github/workflows/update.yml
[2]: https://forgejo.stefka.eu/jiriks74/create-pull-request
2025-03-24 19:15:33 +00:00
9 changed files with 423 additions and 317 deletions

View file

@ -1,56 +1,46 @@
{
"nodes": {
"flake-utils": {
"home-manager": {
"inputs": {
"systems": "systems"
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"lastModified": 1745071558,
"narHash": "sha256-bvcatss0xodcdxXm0LUSLPd2jjrhqO3yFSu3stOfQXg=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "9676e8a52a177d80c8a42f66566362a6d74ecf78",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1741010256,
"narHash": "sha256-WZNlK/KX7Sni0RyqLSqLPbK8k08Kq7H7RijPJbq9KHM=",
"path": "/nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source",
"rev": "ba487dbc9d04e0634c64e3b1f0d25839a0a68246",
"type": "path"
"lastModified": 1744932701,
"narHash": "sha256-fusHbZCyv126cyArUwwKrLdCkgVAIaa/fQJYFlCEqiU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b024ced1aac25639f8ca8fdfc2f8c4fbd66c48ef",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View file

@ -2,10 +2,17 @@
description = "jiriks74's ZSH configuration";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {nixpkgs, ...}: let
outputs = {
self,
nixpkgs,
...
}: let
# Supported systems for your flake packages, shell, etc.
systems = [
"aarch64-linux"
@ -20,25 +27,10 @@
in {
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
homeManagerModules = {
default = {
config,
lib,
pkgs,
...
}: {
inport = ./zsh.nix;
};
withPackages = {
config,
lib,
pkgs,
...
}: {
imports = [
./zsh.nix
./packages.nix
];
zsh = {...}: {
imports = [./modules];
};
default = self.outputs.homeManagerModules.zsh;
};
};
}

262
modules/default.nix Normal file
View file

@ -0,0 +1,262 @@
{
pkgs,
config,
lib,
...
}: let
cfg = config.jiriks74.zsh;
in {
meta.maintainers = with lib.maintainers; [jiriks74];
imports = [
./gitTools.nix
./netTools.nix
./kubernetes.nix
./qolPackages.nix
];
options.jiriks74.zsh.enable = lib.mkEnableOption "Enable jiriks74's zsh config";
config = lib.mkIf cfg.enable {
programs = {
# thefuck = {
# enable = true;
# enableZshIntegration = true;
# };
direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
zsh = {
enable = true;
enableVteIntegration = true;
enableCompletion = true;
completionInit = ''
'';
autosuggestion = {
enable = true;
strategy = [
"match_prev_cmd"
"completion"
"history"
];
};
autocd = true; # I'll try this out, may be removed later
antidote = {
enable = true;
plugins = [
"getantidote/use-omz" # Handle OMZ dependencies
# Load lib only if things break
# "ohmyzsh/ohmyzsh path:lib" # Load OMZ's library
"ohmyzsh/ohmyzsh path:plugins/colored-man-pages" # Load OMZ plugins
# "ohmyzsh/ohmyzsh path:plugins/magic-enter"
"ohmyzsh/ohmyzsh path:plugins/command-not-found" # Provide suggested packages to be installed if a command cannot be found
"ohmyzsh/ohmyzsh path:plugins/dirhistory kind:defer" # shortcuts for navigating directory history and hierarchy
"romkatv/powerlevel10k kind:fpath" # A Zsh theme
"z-shell/F-Sy-H kind:defer" # Feature-rich Syntax Highlighting for Zsh
"zsh-users/zsh-autosuggestions kind:defer" # Simple plugin installation
# { name = "zsh-users/zsh-syntax-highlighting"; }
"zsh-users/zsh-completions kind:fpath path:src" # Adds some missing completions to zsh
"zsh-users/zsh-history-substring-search kind:defer" # ZSH port of Fish history search (up arrow)
"jiriks74/git-aliases kind:defer" # Aliases for git
"MichaelAquilina/zsh-you-should-use" # Did you forget to use an alias?
# "babarot/enhancd" # Includes simmilar functionality to zsh-z
"agkozak/zsh-z" # Jump arount your filesystem with ease
"supercrabtree/k" # Directory listings for Zsh with git features.
"belak/zsh-utils path:completion" # Load and initialize the built-in zsh completion system
"belak/zsh-utils path:editor" # Override and fill in the gaps of the default keybinds
"belak/zsh-utils path:utility kind:defer" # Common shell utilities
"gko/ssh-connect" # List of most used ssh connections
"sineto/web-search kind:defer" # zsh plugin for web searching
];
};
initExtraFirst = ''
# Basic auto/tab complete:
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
_comp_options+=(globdots) # Include hidden files.
if [[ "''${ZSH_PROFILE}" -eq 1 ]]; then
zmodload zsh/zprof # Profiling. Enable `zprof` at the end of initExtra too.
fi
'';
initExtra = ''
# From antidote (for p10k):
# prompts:
# with prompt plugins, remember to add this to your .zshrc:
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
autoload -Uz promptinit && promptinit && prompt powerlevel10k
# Remove nix from path if we are in a container (distrobox)
if [ -v DISTROBOX_ENTER_PATH ]; then
export PATH=$(echo $PATH | tr ':' '\n' | grep -vE '/nix/|/run/wrappers|\.nix-profile|/etc/profiles/per-user/jirka/bin|/run/current-system/sw/bin' | tr '\n' ':')
export PATH=$(echo $PATH | sed 's/:$//')
fi
if [ -v ASCIINEMA_REC ]; then
_zsh_autosuggest_disable
fi
bindkey '^ ' autosuggest-accept # Bind CTRL + Space
bindkey '^Y' autosuggest-accept # Bind CTRL + Y
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
# Extracting
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.tar.xz) tar xJf $1 ;;
*.bz2) bunzip3 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# Kitty binds
if [ "$TERM" = "xterm-kitty" ]; then
alias kssh="kitty +kitten ssh"
alias icat="kitty +kitten icat"
alias d="kitty +kitten diff"
alias get="kitty +kitten transfer"
alias put="kitty +kitten transfer --direction=upload"
alias kclip="kitty +kitten clipboard"
fi
if [[ "''${ZSH_PROFILE}" -eq 1 ]]; then
zprof
fi
'';
localVariables = {
YSU_MESSAGE_POSITION = "after";
# ASCIINEMA_API_URL = "https://asciinema.stefka.eu";
};
shellAliases = {
# update = "sudo nixos-rebuild switch";
ls = "lsd";
# ls, the common ones I use a lot shortened for rapid fire usage
l = "ls -lFh"; #size,show type,human readable
la = "ls -lAFh"; #long list,show almost all,show type,human readable
lr = "ls -tRFh"; #sorted by date,recursive,show type,human readable
lt = "ls -ltFh"; #long list,sorted by date,show type,human readable
ll = "ls -l"; #long list
ldot = "ls -ld .*";
lS = "ls -1FSsh";
lart = "ls -1Fcart";
lrt = "ls -1Fcrt";
grep = "grep --color";
sgrep = "grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} ";
t = "tail -f";
dud = "du -d 1 -h";
duf = "du -sh *";
# fd="find . -type d -name";
ff = "find . -type f -name";
h = "history";
hgrep = "fc -El 0 | grep";
help = "man";
p = "ps -f";
sortnr = "sort -n -r";
unexport = "unset";
# Use trash instead of rm if available
rm = "trash";
cp = "cp -i";
mv = "mv -i";
cls = "clear";
sshc = "ssh-connect";
};
shellGlobalAliases = {
H = "| head";
T = "| tail";
G = "| grep";
L = "| less";
M = "| most";
LL = "2>&1 | less";
CA = "2>&1 | cat -A";
NE = "2> /dev/null";
NUL = "> /dev/null 2>&1";
P = "2>&1| pygmentize -l pytb";
};
history = {
# ignoreAllDups = true;
path = "${config.xdg.cacheHome}/zhistory";
save = 10000;
size = 10000;
share = false;
};
};
};
home.packages = with pkgs; [
nix-zsh-completions
python3Packages.pygments # For antidote
# tools for aliases, etc.
lsd
bat
eza
trash-cli
# ^ tools for aliases, etc.
# packages for enhancd
fzf # enhancd
fd # enhancd
# ^ packages for enhancd
# rofi # for fd
# packags for ex
gnutar
bzip3
unzip
p7zip
unrar
gzip
# ^ packages for ex
];
};
}

29
modules/gitTools.nix Normal file
View file

@ -0,0 +1,29 @@
{
pkgs,
config,
lib,
...
}: let
cfg = config.jiriks74.zsh;
in {
meta.maintainers = with lib.maintainers; [jiriks74];
options.jiriks74.zsh.gitTools = lib.mkEnableOption "Install usefull git tools";
config = lib.mkIf cfg.gitTools {
# assertions = [
# {
# # Condition that must be true
# assertion = cfg.enable;
# # Error message if the assertion fails
# message = ''
# Home-Manager module jiriks74.zsh.gitTools is enabled but jiriks74.zsh is not!
# '';
# }
# ];
home.packages = with pkgs; [
gh
tea
];
};
}

35
modules/kubernetes.nix Normal file
View file

@ -0,0 +1,35 @@
{
pkgs,
config,
lib,
...
}: let
cfg = config.jiriks74.zsh;
in {
meta.maintainers = with lib.maintainers; [jiriks74];
options.jiriks74.zsh.kubernetes = lib.mkEnableOption "Install Kubernetes packages including those for local development";
config = lib.mkIf cfg.kubernetes {
services.podman.enable = true;
home.file.minikube = {
enable = true;
target = ".minikube/config/config.json";
text = ''
{
"container-runtime": "containerd",
"driver": "podman",
"rootless": true
}
'';
};
home.packages = with pkgs; [
minikube
kubectl
kubectx
k9s
];
};
}

22
modules/netTools.nix Normal file
View file

@ -0,0 +1,22 @@
{
pkgs,
config,
lib,
...
}: let
cfg = config.jiriks74.zsh;
in {
meta.maintainers = with lib.maintainers; [jiriks74];
options.jiriks74.zsh.netTools = lib.mkEnableOption "Install usefull network tools";
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
dig
inetutils
iputils
lsof
nmap
];
};
}

41
modules/qolPackages.nix Normal file
View file

@ -0,0 +1,41 @@
{
pkgs,
config,
lib,
...
}: let
cfg = config.jiriks74.zsh;
in {
meta.maintainers = with lib.maintainers; [jiriks74];
options.jiriks74.zsh.qolPackages = lib.mkEnableOption "Install QualityOfLife packages";
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
# asciinema
asciinema_3 # Terminal recording
asciinema-agg # Convert asciinema recordings
libnotify # Notifications
# ^ asciinema
curl
# parsing
gawk
jq
yq
# ^ parsing
python3
# useful dev/everyday tools
encfs
file
htop-vim
tldr
tmux
tree
# ^ useful dev/everyday tools
];
};
}

View file

@ -1,19 +0,0 @@
{pkgs, ...}: {
home.packages = with pkgs; [
# asciinema
asciinema # Terminal recording
asciinema-agg # Convert asciinema recordings
libnotify # Notifications
websocat # For asciinema v2 streams
# ^ asciinema
# useful dev/everyday tools
encfs
file
htop-vim
tldr
tmux
tree
# ^ useful dev/everyday tools
];
}

246
zsh.nix
View file

@ -1,246 +0,0 @@
{
config,
pkgs,
...
}: {
programs = {
# thefuck = {
# enable = true;
# enableZshIntegration = true;
# };
direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
zsh = {
enable = true;
enableVteIntegration = true;
enableCompletion = true;
completionInit = ''
'';
autosuggestion = {
enable = true;
strategy = [
"match_prev_cmd"
"completion"
"history"
];
};
autocd = true; # I'll try this out, may be removed later
antidote = {
enable = true;
plugins = [
"getantidote/use-omz" # Handle OMZ dependencies
# Load lib only if things break
# "ohmyzsh/ohmyzsh path:lib" # Load OMZ's library
"ohmyzsh/ohmyzsh path:plugins/colored-man-pages" # Load OMZ plugins
# "ohmyzsh/ohmyzsh path:plugins/magic-enter"
"ohmyzsh/ohmyzsh path:plugins/command-not-found" # Provide suggested packages to be installed if a command cannot be found
"ohmyzsh/ohmyzsh path:plugins/dirhistory kind:defer" # shortcuts for navigating directory history and hierarchy
"romkatv/powerlevel10k kind:fpath" # A Zsh theme
"z-shell/F-Sy-H kind:defer" # Feature-rich Syntax Highlighting for Zsh
"zsh-users/zsh-autosuggestions kind:defer" # Simple plugin installation
# { name = "zsh-users/zsh-syntax-highlighting"; }
"zsh-users/zsh-completions kind:fpath path:src" # Adds some missing completions to zsh
"zsh-users/zsh-history-substring-search kind:defer" # ZSH port of Fish history search (up arrow)
"jiriks74/git-aliases kind:defer" # Aliases for git
"MichaelAquilina/zsh-you-should-use" # Did you forget to use an alias?
# "babarot/enhancd" # Includes simmilar functionality to zsh-z
"agkozak/zsh-z" # Jump arount your filesystem with ease
"supercrabtree/k" # Directory listings for Zsh with git features.
"belak/zsh-utils path:completion" # Load and initialize the built-in zsh completion system
"belak/zsh-utils path:editor" # Override and fill in the gaps of the default keybinds
"belak/zsh-utils path:utility kind:defer" # Common shell utilities
"gko/ssh-connect" # List of most used ssh connections
"sineto/web-search kind:defer" # zsh plugin for web searching
];
};
initExtraFirst = ''
# Basic auto/tab complete:
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
_comp_options+=(globdots) # Include hidden files.
if [[ "''${ZSH_PROFILE}" -eq 1 ]]; then
zmodload zsh/zprof # Profiling. Enable `zprof` at the end of initExtra too.
fi
'';
initExtra = ''
# From antidote (for p10k):
# prompts:
# with prompt plugins, remember to add this to your .zshrc:
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
autoload -Uz promptinit && promptinit && prompt powerlevel10k
# Remove nix from path if we are in a container (distrobox)
if [ -v DISTROBOX_ENTER_PATH ]; then
export PATH=$(echo $PATH | tr ':' '\n' | grep -vE '/nix/|/run/wrappers|\.nix-profile|/etc/profiles/per-user/jirka/bin|/run/current-system/sw/bin' | tr '\n' ':')
export PATH=$(echo $PATH | sed 's/:$//')
fi
if [ -v ASCIINEMA_REC ]; then
_zsh_autosuggest_disable
fi
bindkey '^ ' autosuggest-accept # Bind CTRL + Space
bindkey '^Y' autosuggest-accept # Bind CTRL + Y
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
# Extracting
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.tar.xz) tar xJf $1 ;;
*.bz2) bunzip3 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# Kitty binds
if [ "$TERM" = "xterm-kitty" ]; then
alias kssh="kitty +kitten ssh"
alias icat="kitty +kitten icat"
alias d="kitty +kitten diff"
alias get="kitty +kitten transfer"
alias put="kitty +kitten transfer --direction=upload"
alias kclip="kitty +kitten clipboard"
fi
if [[ "''${ZSH_PROFILE}" -eq 1 ]]; then
zprof
fi
'';
localVariables = {
YSU_MESSAGE_POSITION = "after";
ASCIINEMA_API_URL = "https://asciinema.stefka.eu";
};
shellAliases = {
# update = "sudo nixos-rebuild switch";
ls = "lsd";
# ls, the common ones I use a lot shortened for rapid fire usage
l = "ls -lFh"; #size,show type,human readable
la = "ls -lAFh"; #long list,show almost all,show type,human readable
lr = "ls -tRFh"; #sorted by date,recursive,show type,human readable
lt = "ls -ltFh"; #long list,sorted by date,show type,human readable
ll = "ls -l"; #long list
ldot = "ls -ld .*";
lS = "ls -1FSsh";
lart = "ls -1Fcart";
lrt = "ls -1Fcrt";
grep = "grep --color";
sgrep = "grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} ";
t = "tail -f";
dud = "du -d 1 -h";
duf = "du -sh *";
# fd="find . -type d -name";
ff = "find . -type f -name";
h = "history";
hgrep = "fc -El 0 | grep";
help = "man";
p = "ps -f";
sortnr = "sort -n -r";
unexport = "unset";
# Use trash instead of rm if available
rm = "trash";
cp = "cp -i";
mv = "mv -i";
cls = "clear";
sshc = "ssh-connect";
};
shellGlobalAliases = {
H = "| head";
T = "| tail";
G = "| grep";
L = "| less";
M = "| most";
LL = "2>&1 | less";
CA = "2>&1 | cat -A";
NE = "2> /dev/null";
NUL = "> /dev/null 2>&1";
P = "2>&1| pygmentize -l pytb";
};
history = {
# ignoreAllDups = true;
path = "${config.xdg.cacheHome}/zhistory";
save = 10000;
size = 10000;
share = false;
};
};
};
home.packages = with pkgs; [
nix-zsh-completions
python312Packages.pygments # For antidote
# tools for aliases, etc.
lsd
bat
eza
trash-cli
# ^ tools for aliases, etc.
# packages for enhancd
fzf # enhancd
fd # enhancd
# ^ packages for enhancd
# rofi # for fd
# packags for ex
gnutar
bzip3
unzip
p7zip
unrar
gzip
# ^ packages for ex
];
}