This commit is contained in:
Laurent Le Houerou 2025-03-10 21:11:26 +04:00
parent 53d0bdf0ce
commit c24d6892ea
3 changed files with 64 additions and 46 deletions

View File

@ -1,16 +1,21 @@
{ pkgs, ... }:
{ pkgs, config, ... }:
{
programs.zsh = {
enable = true;
enableCompletion = true;
enableAutosuggestions = true;
enableSyntaxHighlighting = true;
# History settings
history = {
size = 10000;
path = "$HOME/.zsh_history";
size = 5000;
path = "${config.xdg.stateHome}/zsh/history";
ignoreDups = true;
ignoreAllDups = true;
ignoreSpace = true;
share = true;
extended = true;
};
autosuggestion = {
@ -19,40 +24,39 @@
# Shell options
initExtra = ''
# Enable vi mode
bindkey -v
# Keybindings
bindkey -e
bindkey '^p' history-search-backward
bindkey '^n' history-search-forward
bindkey '^[w' kill-region
# Bind Home key to beginning-of-line
bindkey '^[[H' beginning-of-line
bindkey '^[[1~' beginning-of-line
# Bind End key to end-of-line
bindkey '^[[F' end-of-line
bindkey '^[[4~' end-of-line
# Bind Delete key to delete-char
bindkey '^[[3~' delete-char
# Better history search
bindkey '^R' history-incremental-search-backward
# Basic auto/tab completion
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
_comp_options+=(globdots)
# Terminal settings
export TERM=xterm-256color
'';
# Aliases
shellAliases = {
ll = "ls -la";
ls = "eza";
ll = "eza -alh";
tree = "eza --tree";
dcupd = "docker compose up -d --remove-orphans";
dcdown = "docker compose down";
dclogs = "docker logs -f --tail 100";
vi = "nvim";
vim = "nvim";
lg = "lazygit";
".." = "cd ..";
"..." = "cd ../..";
update = "sudo nixos-rebuild switch";
vim = "nvim";
};
plugins = [
{
name = "zsh-syntax-highlighting";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-syntax-highlighting";
rev = "refs/tags/0.8.0";
sha256 = "1yl8zdip1z9inp280sfa5byjbf2vqh2iazsycar987khjsi5d5w8";
};
}
];
};
programs.oh-my-posh = {
@ -61,4 +65,25 @@
package = pkgs.oh-my-posh;
settings = builtins.fromJSON (builtins.readFile ./oh-my-posh/config.json);
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
programs.zoxide = {
enable = true;
enableZshIntegration = true;
options = ["--cmd" "cd"];
};
programs.eza = {
enable = true;
};
home.packages = with pkgs; [
zsh-syntax-highlighting
zsh-fzf-tab
zsh-completions
];
}

View File

@ -7,11 +7,19 @@ set -e
# Default to the nixos configuration if no argument is provided
CONFIG=${1:-nixos}
# Check if the configuration exists in flake.nix
if ! grep -q "nixosConfigurations.$CONFIG" flake.nix; then
# Use nix itself to list available configurations
AVAILABLE_CONFIGS=$(nix flake show --json | jq -r '.nixosConfigurations | keys[]' 2>/dev/null)
# If the above command fails, fall back to a simple grep method
if [ -z "$AVAILABLE_CONFIGS" ]; then
AVAILABLE_CONFIGS=$(grep -A 100 "nixosConfigurations = {" flake.nix | grep -E "^\s+[a-zA-Z0-9_-]+ = " | sed 's/^\s*\([a-zA-Z0-9_-]*\)\s*=.*/\1/')
fi
# Check if the configuration exists
if ! echo "$AVAILABLE_CONFIGS" | grep -q "^${CONFIG}$"; then
echo "Error: Configuration '$CONFIG' not found in flake.nix"
echo "Available configurations:"
grep -o "nixosConfigurations\.[a-zA-Z0-9_-]*" flake.nix | sed 's/nixosConfigurations\./ - /'
echo "$AVAILABLE_CONFIGS" | sed 's/^/ - /'
exit 1
fi

View File

@ -27,19 +27,4 @@
services.displayManager.defaultSession = "none+i3";
# Additional desktop-specific packages
environment.systemPackages = with pkgs; [
firefox
libreoffice
vlc
gimp
];
# Enable sound
sound.enable = true;
hardware.pulseaudio.enable = true;
# Enable bluetooth
hardware.bluetooth.enable = true;
services.blueman.enable = true;
}