working on zsh

This commit is contained in:
2026-03-11 14:21:24 +01:00
parent cf816ede62
commit 9146ac0124
8812 changed files with 810 additions and 587 deletions
+429 -373
View File
File diff suppressed because it is too large Load Diff
+96 -42
View File
@@ -29,7 +29,7 @@ Droidnix is a modular, declarative NixOS + Home Manager configuration system. It
This project uses a **modular NixOS configuration** with **Hyprland** and **MangoWC** support, designed for **literate programming** and **cross-device reusability**.
The Droidnix repository is organized into two main parts:
1. =.assets/=: Static, non-generated files (e.g., configs, scripts, themes).
2. Generated folders (=common=, =hyprland=, =mangowc=): NixOS and Home Manager configurations, generated from Org files.
2. Generated folders (=system=, =hyprland=, =mangowc=): NixOS and Home Manager configurations, generated from Org files.
#+title: NixOS Configuration Structure
@@ -113,7 +113,7 @@ This directory contains configurations specific to MangoWC.
#+BEGIN_EXAMPLE
.
├── assets
│   ├── common
│   ├── system
│   │   ├── conf
│   │   │   └── base.conf
│   │   ├── cursors
@@ -294,7 +294,7 @@ This directory contains configurations specific to MangoWC.
** First Setup
1. Clone this repository.
2. Run the setup script: =./setup_droidnix.sh=.
3. Edit =.assets/common/conf/base.conf= to choose your window manager (=wm = "hyprland"= or =wm = "mangowc"=).
3. Edit =.assets/system/conf/base.conf= to choose your window manager (=wm = "hyprland"= or =wm = "mangowc"=).
4. Tangle this Org file to generate Nix configurations: =C-c C-v t= in Emacs or use this: =emacs README.org --batch -f org-babel-tangle && emacs --batch --eval "(setq org-html-htmlize-output-type nil)" README.org -f org-html-export-to-html=
5. Build and switch: =sudo nixos-rebuild switch --flake .#<hostname>=.
@@ -306,8 +306,8 @@ This directory contains configurations specific to MangoWC.
:END:
The =.assets/= folder contains all static files, such as configs, scripts, and themes. These files are not generated and can be edited directly.
** =.assets/common/=
This folder contains files shared across both window managers, such as wallpapers, shell configs, and common scripts.
** =.assets/system/=
This folder contains files shared across both window managers, such as wallpapers, shell configs, and system scripts.
- =conf/base.conf=: Defines the window manager choice and other global settings.
- =scripts/=: System-wide scripts (e.g., utilities, helpers).
@@ -646,11 +646,11 @@ This is top file of this level which contains just an import statement for all r
#+END_SRC
** =generated/system/applications/packages.nix=
This will import all packages listed in ./assets/common/apps/packlages.conf
This will import all packages listed in ./assets/system/apps/packlages.conf
#+BEGIN_SRC nix :tangle generated/system/applications/packages.nix :noweb tangle :mkdirp yes :eval never-html
{ config, lib, pkgs, flakeRoot, inputs, ... }:
let
packagesConfPath = "${flakeRoot}/assets/common/apps/packages.conf";
packagesConfPath = "${flakeRoot}/assets/system/apps/packages.conf";
raw = builtins.readFile packagesConfPath;
# IMPORTANT: explicit "\n" so we never accidentally split into characters
rawLines = lib.splitString "\n" raw;
@@ -695,7 +695,7 @@ in
#+END_SRC
** =generated/system/applications/flatpaks.nix=
This will import all packages listed in ./assets/common/apps/flatpaks.conf
This will import all packages listed in ./assets/system/apps/flatpaks.conf
#+BEGIN_SRC nix :tangle generated/system/applications/flatpaks.nix :noweb tangle :mkdirp yes :eval never-html
{
config,
@@ -706,7 +706,7 @@ This will import all packages listed in ./assets/common/apps/flatpaks.conf
}:
let
moduleName = "install-flatpaks";
flatpakConfPath = "${flakeRoot}/assets/common/apps/flatpaks.conf";
flatpakConfPath = "${flakeRoot}/assets/system/apps/flatpaks.conf";
raw = builtins.readFile flatpakConfPath;
# Explicit "\n" so we never accidentally split into characters
rawLines = lib.splitString "\n" raw;
@@ -864,7 +864,7 @@ This is top file of this level which contains just an import statement for all r
# XDG Desktop Portal settings for better application integration
xdg.portal = {
enable = true;
config.common.default = [ "hyprland" "gtk" ];
config.system.default = [ "hyprland" "gtk" ];
};
# Environment variables for a Wayland session
@@ -1290,11 +1290,11 @@ in
# Copy the actual kitty.conf (not a symlink)
xdg.configFile."kitty/kitty.conf".text = lib.concatStringsSep "\n" [
(builtins.readFile "${flakeRoot}/assets/common/conf/kitty/kitty.conf")
(builtins.readFile "${flakeRoot}/assets/system/conf/kitty/kitty.conf")
];
# Copy the theme file
xdg.configFile."kitty/Catppuccin-Mocha.conf".source = "${flakeRoot}/assets/common/conf/kitty/Catppuccin-Mocha.conf";
xdg.configFile."kitty/Catppuccin-Mocha.conf".source = "${flakeRoot}/assets/system/conf/kitty/Catppuccin-Mocha.conf";
};
}
#+END_SRC
@@ -1308,7 +1308,7 @@ This file sets up starship prompt
programs.starship = {
enable = true;
settings = {
configFile = "${flakeRoot}/assets/common/conf/starship.toml";
configFile = "${flakeRoot}/assets/system/conf/starship.toml";
};
};
};
@@ -1318,46 +1318,100 @@ This file sets up starship prompt
** =generated/system/applications/terminal_shell/zsh.nix=
This sets up the zsh terminal
#+BEGIN_SRC nix :tangle generated/system/applications/terminal_shell/zsh.nix :noweb tangle :mkdirp yes :eval never-html
{ config, pkgs, lib, user, flakeRoot, ... }:
let
zshConfigDir = "${config.home-manager.users.${user.username}.xdg.configHome}/zsh";
assetsDir = "${flakeRoot}/assets/common/conf/zsh";
in
{ lib, config, pkgs, ... }:
{
home-manager.users.${user.username} = {
home.packages = with pkgs; [
zsh-syntax-highlighting
];
# --- NixOS Configuration ---
environment.systemPackages = with pkgs; [
zsh
git
docker
];
# --- Home Manager Configuration ---
home-manager.users.henrov = {
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
# Use oh-my-zsh only for themes (optional)
oh-my-zsh = {
enable = true;
theme = "agnoster";
plugins = [
"git"
"docker"
"kubectl"
"history"
"command-not-found"
"extract"
];
};
shellAliases = {
ls = "exa --icons -a --group-directories-first";
ll = "exa --icons -la --group-directories-first";
};
theme = "agnoster"; # Fallback
customThemes = {
catppuccin-mocha = ''
# Catppuccin Mocha colors
local mocha_base="#1E1E2E"
local mocha_surface0="#313244"
local mocha_text="#CDD6F4"
local mocha_lavender="#B4BEFE"
local mocha_blue="#89B4FA"
local mocha_sapphire="#74C7EC"
local mocha_teal="#94E2D5"
local mocha_green="#A6E3A1"
local mocha_yellow="#F9E2AF"
local mocha_peach="#FAB387"
local mocha_maroon="#EBA0AC"
local mocha_red="#F38BA8"
local mocha_mauve="#CBA6F7"
local mocha_pink="#F5C2E7"
local mocha_flamingo="#F2CDCD"
local mocha_rosewater="#F5E0DC"
# Prompt
PROMPT='%{$fg[$mocha_blue]%}%n%{$reset_color%}@%{$fg[$mocha_peach]%}%m%{$reset_color%} %{$fg[$mocha_lavender]%}%~%{$reset_color%} %{$fg[$mocha_red]%}$%{$reset_color%} '
RPROMPT='%{$fg[$mocha_green]%}%T%{$reset_color%}'
# Git prompt
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[$mocha_yellow]%}(%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[$mocha_yellow]%})%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[$mocha_red]%}%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[$mocha_green]%}%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[$mocha_blue]%}%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg[$mocha_blue]%}%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[$mocha_pink]%}?%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[$mocha_sapphire]%}+%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg[$mocha_red]%}!%{$reset_color%}"
# Virtualenv/pyenv
ZSH_THEME_VIRTUAL_ENV_PREFIX="(%{$fg[$mocha_teal]%}"
ZSH_THEME_VIRTUAL_ENV_SUFFIX="%{$reset_color%})"
# Right prompt with Git status
RPROMPT='$(git_prompt_info) %{$fg[$mocha_green]%}%T%{$reset_color%}'
'';
};
theme = "catppuccin-mocha";
};
# Declare all plugins via Nixpkgs for reproducibility
plugins = with pkgs.zshPlugins; [
zsh-autosuggestions
zsh-syntax-highlighting
zsh-completions
zsh-history-substring-search
zsh-you-should-use # Optional: Suggests aliases
];
# Source plugins that need explicit activation
initExtra = ''
source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source ${pkgs.zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh
ZSH_THEME="catppuccin-mocha"
'';
};
# Use the .zshrc file from assets
xdg.configFile."zsh/.zshrc".source = "${assetsDir}/.zshrc";
# Home Manager packages (optional, if not already in systemPackages)
home.packages = with pkgs; [
direnv
git-extras
];
};
}
#+END_SRC
** =generated/system/development/databases/top.nix=
This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder
#+BEGIN_SRC nix :tangle generated/system/development/databases/top.nix :noweb tangle :mkdirp yes :eval never-html
-84
View File
@@ -1,84 +0,0 @@
typeset -U path cdpath fpath manpath
for profile in ${(z)NIX_PROFILES}; do
fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions)
done
HELPDIR="${ZSH_HELPDIR:-${XDG_DATA_HOME:-$HOME/.local/share}/zsh/$ZSH_VERSION/help}"
# Source zsh-autosuggestions (use environment variable)
if [ -n "$ZSH_AUTOSUGGESTIONS_PATH" ]; then
source "$ZSH_AUTOSUGGESTIONS_PATH"
ZSH_AUTOSUGGEST_STRATEGY=(history)
fi
# oh-my-zsh extra settings for plugins
plugins=(git sudo extract colored-man-pages command-not-found history docker kubectl)
source "$ZSH/oh-my-zsh.sh"
# Source zoxide (use environment variable)
if [ -n "$ZOXIDE_INIT" ]; then
eval "$($ZOXIDE_INIT zsh)"
fi
# History options should be set in .zshrc and after oh-my-zsh sourcing.
HISTSIZE="10000"
SAVEHIST="10000"
HISTFILE="${XDG_CONFIG_HOME:-$HOME/.config}/zsh/.zsh_history"
mkdir -p "$(dirname "$HISTFILE")"
# Source fzf (use environment variable)
if [[ $options[zle] = on ]] && [ -n "$FZF_ZSH" ]; then
source <($FZF_ZSH --zsh)
fi
# Source zsh-syntax-highlighting (use environment variable)
if [ -n "$ZSH_SYNTAX_HIGHLIGHTING_PATH" ]; then
source "$ZSH_SYNTAX_HIGHLIGHTING_PATH"
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main)
fi
# Source catppuccin zsh-syntax-highlighting (use environment variable)
if [ -n "$CATPPUCCIN_ZSH_SYNTAX_PATH" ]; then
source "$CATPPUCCIN_ZSH_SYNTAX_PATH"
fi
# Set shell options
set_opts=(
HIST_FCNTL_LOCK HIST_IGNORE_DUPS HIST_IGNORE_SPACE SHARE_HISTORY autocd
NO_APPEND_HISTORY NO_EXTENDED_HISTORY NO_HIST_EXPIRE_DUPS_FIRST
NO_HIST_FIND_NO_DUPS NO_HIST_IGNORE_ALL_DUPS NO_HIST_SAVE_NO_DUPS
)
for opt in "${set_opts[@]}"; do
setopt "$opt"
done
unset opt set_opts
# Source starship (use environment variable)
# if [[ $TERM != "dumb" ]] && [ -n "$STARSHIP_INIT" ]; then
# eval "$($STARSHIP_INIT zsh)"
# fi
# Kitty shell integration
if test -n "$KITTY_INSTALLATION_DIR"; then
export KITTY_SHELL_INTEGRATION="no-rc"
autoload -Uz -- "$KITTY_INSTALLATION_DIR/shell-integration/zsh/kitty-integration"
kitty-integration
unfunction kitty-integration
fi
# Source direnv (use environment variable)
if [ -n "$DIRENV_HOOK" ]; then
eval "$($DIRENV_HOOK zsh)"
fi
# Aliases
# alias -- la='eza -a'
# alias -- ll='eza -l'
# alias -- lla='eza -la'
# alias -- ls='eza'
# alias -- lt='eza --tree'
# Eat shell integration
[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/zsh"
@@ -1,55 +0,0 @@
#!/usr/bin/env zsh
# --- Environment Variables ---
export EDITOR="nvim"
export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/.cargo/bin:$PATH" # Example: Add Rust's cargo binaries
# --- Aliases ---
# (You can move these from your Nix config to here if you prefer)
alias gs="git status"
alias ga="git add"
alias gc="git commit -m"
alias gp="git push"
alias gco="git checkout"
alias ll="exa --icons -la --group-directories-first"
alias ls="exa --icons -a --group-directories-first"
# --- Functions ---
# Example: Create a new directory and cd into it
mkcd() {
mkdir -p "$1" && cd "$1"
}
# --- Shell Options ---
setopt HIST_IGNORE_ALL_DUPS # Ignore duplicate commands in history
setopt HIST_IGNORE_SPACE # Ignore commands starting with a space
setopt APPEND_HISTORY # Append to history file, don't overwrite
setopt INC_APPEND_HISTORY # Append to history file as soon as the command is entered
# --- Key Bindings ---
# Example: Edit command line in $EDITOR
autoload -U edit-command-line
zle -N edit-command-line
bindkey '^xe' edit-command-line # Ctrl+x, e
# --- Prompt Customization ---
# (Starship usually handles this, but you can add pre-starship prompts here)
# --- Load other files ---
# Source other files (e.g., secrets, local overrides)
[[ -f "$HOME/.zshrc.local" ]] && source "$HOME/.zshrc.local"
# --- Fuzzy Finder (fzf) ---
# If not already loaded in .zshrc
[[ $- == *i* ]] && source "$(brew --prefix)/opt/fzf/shell/key-bindings.zsh" 2>/dev/null
[[ $- == *i* ]] && source "$(brew --prefix)/opt/fzf/shell/completion.zsh" 2>/dev/null
# --- Conditional Loading ---
# Only load if not already loaded
if [[ -z "$TMUX" ]]; then
# Example: Start tmux if not already in a session
if command -v tmux &>/dev/null && [ -n "$PS1" ]; then
exec tmux
fi
fi
@@ -0,0 +1,72 @@
##############################################
# Aliases (source-of-truth)
#
# This file is written in bash/zsh alias syntax in [bash_zsh], [bash_specific], [zsh_specific].
# Fish has different syntax; the Nix module translates [bash_zsh] into fish format and then
# appends [fish_specific] as-is.
##############################################
##############################################
# Generic aliases (bash/zsh)
# These are intended to be available in bash and zsh.
##############################################
[bash_zsh]
alias ll='ls -lah'
alias gs='git status'
alias ga='git add'
alias gc='git commit'
alias gp='git push'
alias gcp='git add . && git commit && git push'
alias cd='z'
alias nps='xdg-open https://search.nixos.org'
alias hvnx='cd ~/Repos/nixos/henrovnix_ok'
alias emt='hvnx && emacs README.org --batch -f org-babel-tangle && emacs -Q --batch README.org -f org-html-export-to-html'
alias nxs='hvnx && sudo nixos-rebuild switch --flake .#traveldroid'
alias nxt='hvnx && sudo nixos-rebuild test --flake .#traveldroid'
alias nxv='hvnx && sudo nixos-rebuild build-vm --flake .#traveldroid && "$(ls -1 ./result/bin/run-*-vm | head -n 1)"'
alias rb='systemctl reboot'
alias po='systemctl poweroff'
alias fpl='flatpak list'
alias fps='flatpak search'
alias fpi='flatpak install'
alias fpr='flatpak run'
alias nxc='ssh henrov@nextcloud.data-pro.nu'
alias vs='code'
alias blog='cd ~/Repos/blog && ll'
alias keys='hyprctl binds'
##############################################
# Shell-specific aliases / examples
#
# Everything below is COMMENTED OUT on purpose.
# These examples show syntax or commands that are shell-specific
# (or behave differently across shells).
##############################################
[bash_specific]
# Enable recursive globbing (**)
# alias sg='shopt -s globstar'
[zsh_specific]
# Recursive globbing works by default in zsh; this prints matches one-per-line
# alias recglob='print -l **/*.nix'
[fish_specific]
# Fish has its own language; this is fish-only syntax (not bash/zsh)
# alias setvar='set -gx EDITOR emacs'
[dash_specific]
# dash is a minimal POSIX shell; shown here only as an example
# alias com='command -v ls'
[nushell_specific]
# Nushell pipelines structured data; this is nu-only syntax
# alias fbf='ls | where size > 1mb | get name'
@@ -0,0 +1,15 @@
##############################################
# Enabled shells (source-of-truth)
#
# Edit this file in the repo:
# ./assets/conf/dev/terminal/enabled_shells.conf
#
# After changing, rebuild Home Manager / your system as you normally do.
##############################################
[enabled_shells]
bash = yes
zsh = yes
fish = no
dash = no
nushell = no
@@ -0,0 +1,84 @@
# vim:ft=kitty
## name: Catppuccin Kitty Mocha
## author: Catppuccin Org
## license: MIT
## upstream: https://github.com/catppuccin/kitty/blob/main/themes/mocha.conf
## blurb: Soothing pastel theme for the high-spirited!
# The basic colors
foreground #cdd6f4
background #1e1e2e
selection_foreground #1e1e2e
selection_background #f5e0dc
# Cursor colors
cursor #f5e0dc
cursor_text_color #1e1e2e
# Scrollbar colors
scrollbar_handle_color #9399b2
scrollbar_track_color #45475a
# URL color when hovering with mouse
url_color #f5e0dc
# Kitty window border colors
active_border_color #b4befe
inactive_border_color #6c7086
bell_border_color #f9e2af
# OS Window titlebar colors
wayland_titlebar_color system
macos_titlebar_color system
# Tab bar colors
active_tab_foreground #11111b
active_tab_background #cba6f7
inactive_tab_foreground #cdd6f4
inactive_tab_background #181825
tab_bar_background #11111b
# Colors for marks (marked text in the terminal)
mark1_foreground #1e1e2e
mark1_background #b4befe
mark2_foreground #1e1e2e
mark2_background #cba6f7
mark3_foreground #1e1e2e
mark3_background #74c7ec
# The 16 terminal colors
# black
color0 #45475a
color8 #585b70
# red
color1 #f38ba8
color9 #f38ba8
# green
color2 #a6e3a1
color10 #a6e3a1
# yellow
color3 #f9e2af
color11 #f9e2af
# blue
color4 #89b4fa
color12 #89b4fa
# magenta
color5 #f5c2e7
color13 #f5c2e7
# cyan
color6 #94e2d5
color14 #94e2d5
# white
color7 #bac2de
color15 #a6adc8
@@ -0,0 +1,26 @@
// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run `zed: open default settings` from the
// command palette (cmd-shift-p / ctrl-shift-p)
{
"agent": {
"default_model": {
"provider": "ollama",
"model": "codellama:34b",
"enable_thinking": false
},
"favorite_models": [],
"model_parameters": []
},
"ui_font_size": 16,
"buffer_font_size": 15,
"theme": {
"mode": "system",
"light": "One Light",
"dark": "One Dark",
},
}

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 126 KiB

Before

Width:  |  Height:  |  Size: 290 KiB

After

Width:  |  Height:  |  Size: 290 KiB

Before

Width:  |  Height:  |  Size: 306 KiB

After

Width:  |  Height:  |  Size: 306 KiB

Before

Width:  |  Height:  |  Size: 391 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Before

Width:  |  Height:  |  Size: 203 KiB

After

Width:  |  Height:  |  Size: 203 KiB

Before

Width:  |  Height:  |  Size: 382 KiB

After

Width:  |  Height:  |  Size: 382 KiB

Before

Width:  |  Height:  |  Size: 224 KiB

After

Width:  |  Height:  |  Size: 224 KiB

Before

Width:  |  Height:  |  Size: 221 KiB

After

Width:  |  Height:  |  Size: 221 KiB

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 98 KiB

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 123 KiB

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 133 KiB

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Before

Width:  |  Height:  |  Size: 149 KiB

After

Width:  |  Height:  |  Size: 149 KiB

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 112 KiB

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 112 KiB

Some files were not shown because too many files have changed in this diff Show More