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
+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