reorganization into flat profile-based modules

This commit is contained in:
Semere Meharena Mebrahtom 2026-07-19 16:08:17 +02:00
parent 1bc8c22feb
commit 127227205d
Signed by: semere
GPG key ID: 7FC937214DF30488
15 changed files with 660 additions and 696 deletions

View file

@ -35,7 +35,7 @@
in in
lib.nixosSystem { lib.nixosSystem {
system = hostConfig.system; system = hostConfig.system;
specialArgs = { inherit userVars; }; specialArgs = { inherit userVars self; };
modules = [ modules = [
hostConfig.configModule hostConfig.configModule
] ]
@ -45,7 +45,7 @@
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = { inherit userVars; }; extraSpecialArgs = { inherit userVars self; };
backupFileExtension = "backup"; backupFileExtension = "backup";
}; };
} }
@ -55,5 +55,6 @@
in in
{ {
inherit nixosConfigurations; inherit nixosConfigurations;
nixosModules = import ./modules { inherit lib self; };
}; };
} }

View file

@ -5,24 +5,15 @@
config, config,
lib, lib,
pkgs, pkgs,
self,
... ...
}: }:
{ {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
../../modules self.nixosModules.desktop-suite
]; ];
networking.hostName = "nabro"; networking.hostName = "nabro";
dotfiles = {
core.enable = true;
user.enable = true;
desktop.enable = true;
dev.enable = true;
shell.enable = true;
zsh.enable = true;
helix.enable = true;
};
}; };
} }

18
modules/cli-tools.nix Normal file
View file

@ -0,0 +1,18 @@
{
config,
lib,
pkgs,
...
}:
{
environment.systemPackages = with pkgs; [
wget
tealdeer
p7zip
btop
opencode
fd
ripgrep
];
}

View file

@ -5,60 +5,51 @@
... ...
}: }:
let
cfg = config.dotfiles.core;
in
{ {
options.dotfiles.core = { boot.loader.systemd-boot.enable = true;
enable = lib.mkEnableOption "Core system configuration"; boot.loader.efi.canTouchEfiVariables = true;
}; boot.kernelPackages = pkgs.linuxPackages_latest;
boot.consoleLogLevel = 0;
boot.initrd.verbose = false;
boot.kernelParams = [
"quiet"
"splash"
"boot.shell_on_fail"
"loglevel=3"
"rd.systemd.show_status=false"
"rd.udev.log_level=3"
"udev.log_priority=3"
];
config = lib.mkIf cfg.enable { time.timeZone = "Europe/Berlin";
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.consoleLogLevel = 0;
boot.initrd.verbose = false;
boot.kernelParams = [
"quiet"
"splash"
"boot.shell_on_fail"
"loglevel=3"
"rd.systemd.show_status=false"
"rd.udev.log_level=3"
"udev.log_priority=3"
];
time.timeZone = "Europe/Berlin"; networking.networkmanager.enable = true;
networking.networkmanager.enable = true; services.power-profiles-daemon.enable = true;
services.power-profiles-daemon.enable = true; services.logind = {
settings = {
services.logind = { Login = {
settings = { HandleLidSwitch = "suspend-then-hibernate";
Login = { HibernateDelaySec = "1800";
HandleLidSwitch = "suspend-then-hibernate";
HibernateDelaySec = "1800";
};
}; };
}; };
nix = {
settings = {
experimental-features = [
"nix-command"
"flakes"
];
auto-optimise-store = true;
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
};
system.stateVersion = "26.05";
}; };
nix = {
settings = {
experimental-features = [
"nix-command"
"flakes"
];
auto-optimise-store = true;
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
};
system.stateVersion = "26.05";
} }

View file

@ -1,16 +1,41 @@
{ { lib, self, ... }:
config, let
lib, moduleDirectoryList = builtins.filter (
pkgs, name: name != "default.nix" && lib.strings.hasSuffix ".nix" name
... ) (builtins.attrNames (builtins.readDir ./.));
}:
{ allModules = builtins.listToAttrs (
imports = [ builtins.map (entry: {
./core.nix name = lib.strings.removeSuffix ".nix" entry;
./user.nix value = ./. + "/${entry}";
./desktop.nix }) moduleDirectoryList
./dev.nix );
./shell in
]; allModules
// {
desktop-suite = {
imports = [
self.nixosModules.core
self.nixosModules.user
self.nixosModules.desktop
self.nixosModules.dev
self.nixosModules.cli-tools
self.nixosModules.git
self.nixosModules.gpg
self.nixosModules.zsh
self.nixosModules.helix
];
};
core-suite = {
imports = [
self.nixosModules.core
self.nixosModules.user
self.nixosModules.cli-tools
self.nixosModules.git
self.nixosModules.gpg
self.nixosModules.zsh
self.nixosModules.helix
];
};
} }

View file

@ -6,135 +6,126 @@
... ...
}: }:
let
cfg = config.dotfiles.desktop;
in
{ {
options.dotfiles.desktop = { programs.dwl.enable = true;
enable = lib.mkEnableOption "Graphical desktop environment (DWL)"; programs.dwl.package = pkgs.dwl.override {
configH = ../hosts/nabro/dwl-config.h;
}; };
config = lib.mkIf cfg.enable { services.pipewire = {
programs.dwl.enable = true; enable = true;
programs.dwl.package = pkgs.dwl.override { pulse.enable = true;
configH = ../hosts/nabro/dwl-config.h; alsa.enable = true;
}; jack.enable = true;
};
services.pipewire = { fonts.packages = with pkgs; [
nerd-fonts.jetbrains-mono
noto-fonts
noto-fonts-color-emoji
];
fonts.fontconfig.defaultFonts = {
monospace = [
"JetBrainsMono Nerd Font"
"Noto Sans Mono"
];
emoji = [ "Noto Color Emoji" ];
};
hardware.graphics.enable = true;
security.polkit.enable = true;
security.pam.services.swaylock = { };
services.getty.autologinUser = "${userVars.username}";
environment.systemPackages = with pkgs; [
pamixer
brightnessctl
wl-clipboard
wmenu
fnott
foot
firefox
tor-browser
grim
slurp
wlopm
];
home-manager.users."${userVars.username}" = {
programs.foot = {
enable = true; enable = true;
pulse.enable = true; settings = {
alsa.enable = true; main = {
jack.enable = true; font = "JetBrainsMono Nerd Font:size=13";
};
};
}; };
fonts.packages = with pkgs; [ programs.swaylock = {
nerd-fonts.jetbrains-mono enable = true;
noto-fonts package = pkgs.swaylock-effects;
noto-fonts-color-emoji settings = {
]; clock = true;
indicator = true;
screenshots = true;
effect-blur = "7x5";
effect-vignette = "0.5:0.5";
ring-color = "b085f5";
key-hl-color = "5e35b1";
line-color = "00000000";
inside-color = "00000088";
separator-color = "00000000";
fade-in = 0.2;
};
};
fonts.fontconfig.defaultFonts = { services.swayidle = {
monospace = [ enable = true;
"JetBrainsMono Nerd Font" events = {
"Noto Sans Mono" before-sleep = "${pkgs.swaylock-effects}/bin/swaylock -f";
lock = "${pkgs.swaylock-effects}/bin/swaylock -f";
};
timeouts = [
{
timeout = 300;
command = "${pkgs.swaylock-effects}/bin/swaylock -f";
}
{
timeout = 600;
command = "${pkgs.wlopm}/bin/wlopm --off '*'";
resumeCommand = "${pkgs.wlopm}/bin/wlopm --on '*'";
}
{
timeout = 900;
command = "${pkgs.systemd}/bin/systemctl hibernate";
}
]; ];
emoji = [ "Noto Color Emoji" ];
}; };
hardware.graphics.enable = true; services.wlsunset = {
security.polkit.enable = true; enable = true;
security.pam.services.swaylock = { }; latitude = "52.5";
longitude = "13.4";
services.getty.autologinUser = "${userVars.username}"; temperature = {
day = 6500;
environment.systemPackages = with pkgs; [ night = 4000;
pamixer
brightnessctl
wl-clipboard
wmenu
fnott
foot
firefox
tor-browser
grim
slurp
wlopm
];
home-manager.users."${userVars.username}" = {
programs.foot = {
enable = true;
settings = {
main = {
font = "JetBrainsMono Nerd Font:size=13";
};
};
}; };
};
programs.swaylock = { services.fnott = {
enable = true; enable = true;
package = pkgs.swaylock-effects; settings = {
settings = { main = {
clock = true; font = "JetBrainsMono Nerd Font:size=11";
indicator = true; background = "1a1a24e0";
screenshots = true; border-color = "b085f5ff";
effect-blur = "7x5"; border-size = 2;
effect-vignette = "0.5:0.5"; padding-vertical = 12;
ring-color = "b085f5"; padding-horizontal = 16;
key-hl-color = "5e35b1"; summary-color = "ffffffff";
line-color = "00000000"; body-color = "e0e0e0ff";
inside-color = "00000088";
separator-color = "00000000";
fade-in = 0.2;
};
};
services.swayidle = {
enable = true;
events = {
before-sleep = "${pkgs.swaylock-effects}/bin/swaylock -f";
lock = "${pkgs.swaylock-effects}/bin/swaylock -f";
};
timeouts = [
{
timeout = 300;
command = "${pkgs.swaylock-effects}/bin/swaylock -f";
}
{
timeout = 600;
command = "${pkgs.wlopm}/bin/wlopm --off '*'";
resumeCommand = "${pkgs.wlopm}/bin/wlopm --on '*'";
}
{
timeout = 900;
command = "${pkgs.systemd}/bin/systemctl hibernate";
}
];
};
services.wlsunset = {
enable = true;
latitude = "52.5";
longitude = "13.4";
temperature = {
day = 6500;
night = 4000;
};
};
services.fnott = {
enable = true;
settings = {
main = {
font = "JetBrainsMono Nerd Font:size=11";
background = "1a1a24e0";
border-color = "b085f5ff";
border-size = 2;
padding-vertical = 12;
padding-horizontal = 16;
summary-color = "ffffffff";
body-color = "e0e0e0ff";
};
}; };
}; };
}; };

View file

@ -5,27 +5,18 @@
... ...
}: }:
let
cfg = config.dotfiles.dev;
in
{ {
options.dotfiles.dev = { environment.systemPackages = with pkgs; [
enable = lib.mkEnableOption "Development tools and language servers"; gcc
}; gnumake
clang-tools
config = lib.mkIf cfg.enable { lldb
environment.systemPackages = with pkgs; [ python3
gcc uv
gnumake ruff
clang-tools ty
lldb nil
python3 nixd
uv nixfmt
ruff ];
ty
nil
nixd
nixfmt
];
};
} }

27
modules/git.nix Normal file
View file

@ -0,0 +1,27 @@
{
config,
lib,
pkgs,
userVars,
...
}:
{
home-manager.users."${userVars.username}" = {
programs.git = {
enable = true;
settings = {
user = {
name = userVars.fullName;
email = userVars.email;
};
commit.gpgsign = true;
gpg.program = "gpg";
};
signing = {
key = userVars.gpgKey;
signByDefault = true;
};
};
};
}

24
modules/gpg.nix Normal file
View file

@ -0,0 +1,24 @@
{
config,
lib,
pkgs,
userVars,
...
}:
{
environment.systemPackages = with pkgs; [
gnupg
pass
pinentry-qt
];
home-manager.users."${userVars.username}" = {
services.gpg-agent = {
enable = true;
defaultCacheTtl = 1800;
enableSshSupport = true;
pinentry.package = pkgs.pinentry-qt;
};
};
}

146
modules/helix.nix Normal file
View file

@ -0,0 +1,146 @@
{
config,
lib,
pkgs,
userVars,
...
}:
{
home-manager.users."${userVars.username}" = {
programs.helix = {
enable = true;
defaultEditor = true;
settings = {
theme = "ayu_dark";
editor = {
line-number = "relative";
mouse = false;
color-modes = true;
auto-format = true;
completion-timeout = 5;
completion-replace = true;
preview-completion-insert = true;
scrolloff = 8;
cursorline = true;
auto-info = true;
rulers = [ 80 ];
bufferline = "multiple";
shell = [
"zsh"
"-c"
];
jump-label-alphabet = "asdfghjklqwertyuiopzxcvbnm";
cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};
inline-diagnostics = {
cursor-line = "warning";
other-lines = "disable";
};
file-picker = {
hidden = false;
git-ignore = true;
git-global = true;
};
statusline = {
left = [
"mode"
"file-base-name"
"version-control"
];
center = [ ];
right = [
"diagnostics"
"selections"
"position"
"file-encoding"
"file-type"
];
separator = "";
};
lsp = {
display-messages = true;
display-inlay-hints = true;
};
indent-guides = {
render = true;
character = "";
skip-levels = 1;
};
soft-wrap = {
enable = true;
};
smart-tab = {
enable = true;
supersede-menu = true;
};
};
};
languages = {
language = [
{
name = "python";
language-servers = [
"ty"
"ruff"
];
formatter = {
command = "ruff";
args = [
"format"
"-"
];
};
auto-format = true;
}
{
name = "c";
language-servers = [ "clangd" ];
formatter = {
command = "clang-format";
args = [ "--style=file" ];
};
auto-format = true;
}
{
name = "nix";
language-servers = [ "nixd" ];
formatter = {
command = "nixfmt";
};
auto-format = true;
}
];
language-server = {
nixd = {
command = "nixd";
};
ruff = {
command = "ruff";
};
ty = {
command = "ty";
args = [ "server" ];
};
clangd = {
command = "clangd";
};
};
};
};
};
}

View file

@ -1,66 +0,0 @@
{
config,
lib,
pkgs,
userVars,
...
}:
let
cfg = config.dotfiles.shell;
shellDir = ./.;
otherShellFiles = builtins.filter (
name: name != "default.nix" && lib.strings.hasSuffix ".nix" name
) (builtins.attrNames (builtins.readDir shellDir));
importedModules = map (file: shellDir + "/${file}") otherShellFiles;
in
{
imports = importedModules;
options.dotfiles.shell = {
enable = lib.mkEnableOption "Shell, Git, GPG, and CLI environment";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
git
wget
tealdeer
gnupg
pass
p7zip
btop
helix
opencode
fd
ripgrep
];
home-manager.users."${userVars.username}" = {
programs.git = {
enable = true;
settings = {
user = {
name = userVars.fullName;
email = userVars.email;
};
commit.gpgsign = true;
gpg.program = "gpg";
};
signing = {
key = userVars.gpgKey;
signByDefault = true;
};
};
services.gpg-agent = {
enable = true;
defaultCacheTtl = 1800;
enableSshSupport = true;
pinentry.package = pkgs.pinentry-qt;
};
};
};
}

View file

@ -1,155 +0,0 @@
{
config,
lib,
pkgs,
userVars,
...
}:
let
cfg = config.dotfiles.helix;
in
{
options.dotfiles.helix = {
enable = lib.mkEnableOption "Fully configured Helix editor";
};
config = lib.mkIf cfg.enable {
home-manager.users."${userVars.username}" = {
programs.helix = {
enable = true;
defaultEditor = true;
settings = {
theme = "ayu_dark";
editor = {
line-number = "relative";
mouse = false;
color-modes = true;
auto-format = true;
completion-timeout = 5;
completion-replace = true;
preview-completion-insert = true;
scrolloff = 8;
cursorline = true;
auto-info = true;
rulers = [ 80 ];
bufferline = "multiple";
shell = [
"zsh"
"-c"
];
jump-label-alphabet = "asdfghjklqwertyuiopzxcvbnm";
cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};
inline-diagnostics = {
cursor-line = "warning";
other-lines = "disable";
};
file-picker = {
hidden = false;
git-ignore = true;
git-global = true;
};
statusline = {
left = [
"mode"
"file-base-name"
"version-control"
];
center = [ ];
right = [
"diagnostics"
"selections"
"position"
"file-encoding"
"file-type"
];
separator = "";
};
lsp = {
display-messages = true;
display-inlay-hints = true;
};
indent-guides = {
render = true;
character = "";
skip-levels = 1;
};
soft-wrap = {
enable = true;
};
smart-tab = {
enable = true;
supersede-menu = true;
};
};
};
languages = {
language = [
{
name = "python";
language-servers = [
"ty"
"ruff"
];
formatter = {
command = "ruff";
args = [
"format"
"-"
];
};
auto-format = true;
}
{
name = "c";
language-servers = [ "clangd" ];
formatter = {
command = "clang-format";
args = [ "--style=file" ];
};
auto-format = true;
}
{
name = "nix";
language-servers = [ "nixd" ];
formatter = {
command = "nixfmt";
};
auto-format = true;
}
];
language-server = {
nixd = {
command = "nixd";
};
ruff = {
command = "ruff";
};
ty = {
command = "ty";
args = [ "server" ];
};
clangd = {
command = "clangd";
};
};
};
};
};
};
}

View file

@ -1,243 +0,0 @@
{
config,
lib,
pkgs,
userVars,
...
}:
let
cfg = config.dotfiles.zsh;
in
{
options.dotfiles.zsh = {
enable = lib.mkEnableOption "Fully configured Zsh terminal environment";
};
config = lib.mkIf cfg.enable {
programs.zsh.enable = true;
users.users."${userVars.username}".shell = pkgs.zsh;
home-manager.users."${userVars.username}" = {
programs.zsh = {
enable = true;
enableCompletion = false;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
dotDir = "/home/${userVars.username}/.config/zsh";
initContent = ''
# -- GPG / SSH Configuration --
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
# Import Wayland environment to systemd for GUI tools (like pinentry-gnome3)
if [ -n "$WAYLAND_DISPLAY" ]; then
systemctl --user import-environment WAYLAND_DISPLAY DISPLAY DBUS_SESSION_BUS_ADDRESS 2>/dev/null
dbus-update-activation-environment --systemd WAYLAND_DISPLAY DISPLAY DBUS_SESSION_BUS_ADDRESS 2>/dev/null
fi
# Automatically start dwl on TTY 1
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
exec dwl
fi
'';
history = {
size = 10000;
save = 10000;
path = "$HOME/.local/share/zsh/history";
ignoreDups = true;
ignoreAllDups = true;
ignoreSpace = true;
share = true;
extended = true;
};
plugins = [
{
name = "fast-syntax-highlighting";
src = pkgs.zsh-fast-syntax-highlighting.src;
}
{
name = "zsh-autosuggestions";
src = pkgs.zsh-autosuggestions.src;
}
{
name = "zsh-history-substring-search";
src = pkgs.zsh-history-substring-search.src;
}
{
name = "fzf-tab";
src = pkgs.zsh-fzf-tab.src;
}
];
shellAliases = {
ls = "eza --group-directories-first";
ll = "eza -l --group-directories-first --git";
la = "eza -la --group-directories-first --git";
lt = "eza --tree --level=2";
cat = "bat --paging=never";
grep = "grep --color=auto";
gs = "git status -sb";
gd = "git diff";
gc = "git commit";
gp = "git push";
ga = "git add -A";
gm = "git add -m";
gl = "git log --oneline";
cleanup = "sudo nix-collect-garbage -d";
".." = "cd ..";
"..." = "cd ../..";
};
};
programs.starship = {
enable = true;
enableZshIntegration = true;
settings = {
add_newline = false;
command_timeout = 500;
scan_timeout = 10;
format = lib.concatStrings [
"$directory"
"$git_branch"
"$git_status"
"$nix_shell"
"$python"
"$c"
"$rust"
"$cmd_duration"
"$jobs"
"$line_break"
"$character"
];
character = {
success_symbol = "[](bold green)";
error_symbol = "[](bold red)";
vimcmd_symbol = "[](bold yellow)";
};
directory = {
style = "bold cyan";
truncation_length = 3;
truncate_to_repo = true;
truncation_symbol = "/";
read_only = " 🔒";
};
git_branch = {
style = "bold purple";
format = "[$symbol$branch]($style) ";
symbol = " ";
};
git_status = {
style = "bold red";
format = "([$all_status$ahead_behind]($style)) ";
conflicted = "=";
ahead = "\${count}";
behind = "\${count}";
diverged = "\${ahead_count}\${behind_count}";
staged = "+\${count}";
modified = "!\${count}";
untracked = "?\${count}";
stashed = "\$";
};
nix_shell = {
style = "bold blue";
format = "[$symbol$state( \($name\))]($style) ";
symbol = " ";
impure_msg = "impure";
pure_msg = "pure";
};
python = {
style = "bold yellow";
format = "[$symbol( \($virtualenv\))]($style) ";
symbol = " ";
detect_extensions = [ "py" ];
detect_files = [
"pyproject.toml"
"requirements.txt"
"uv.lock"
];
};
c = {
style = "bold dimmed white";
format = "[$symbol($version(-$name))]($style) ";
symbol = " ";
detect_extensions = [
"c"
"h"
];
};
rust = {
disabled = true;
};
cmd_duration = {
style = "bold yellow";
format = "[$duration]($style) ";
min_time = 2000;
show_notifications = false;
};
jobs = {
style = "bold blue";
symbol = "";
number_threshold = 1;
};
aws.disabled = true;
gcloud.disabled = true;
docker_context.disabled = true;
kubernetes.disabled = true;
package.disabled = true;
battery.disabled = true;
};
};
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
programs.eza = {
enable = true;
enableZshIntegration = true;
icons = "auto";
};
programs.bat = {
enable = true;
config = {
theme = "ansi";
};
};
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
programs.fzf = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
defaultCommand = "fd --type f --hidden --exclude .git";
};
};
};
}

View file

@ -6,27 +6,18 @@
... ...
}: }:
let
cfg = config.dotfiles.user;
in
{ {
options.dotfiles.user = { users.users."${userVars.username}" = {
enable = lib.mkEnableOption "User configuration"; isNormalUser = true;
extraGroups = [
"wheel"
"networkmanager"
];
}; };
config = lib.mkIf cfg.enable { home-manager.users."${userVars.username}" = {
users.users."${userVars.username}" = { home.username = userVars.username;
isNormalUser = true; home.homeDirectory = "/home/${userVars.username}";
extraGroups = [ home.stateVersion = "26.05";
"wheel"
"networkmanager"
];
};
home-manager.users."${userVars.username}" = {
home.username = userVars.username;
home.homeDirectory = "/home/${userVars.username}";
home.stateVersion = "26.05";
};
}; };
} }

232
modules/zsh.nix Normal file
View file

@ -0,0 +1,232 @@
{
config,
lib,
pkgs,
userVars,
...
}:
{
programs.zsh.enable = true;
users.users."${userVars.username}".shell = pkgs.zsh;
home-manager.users."${userVars.username}" = {
programs.zsh = {
enable = true;
enableCompletion = false;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
dotDir = "/home/${userVars.username}/.config/zsh";
initContent = ''
# -- GPG / SSH Configuration --
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
# Import Wayland environment to systemd for GUI tools (like pinentry-gnome3)
if [ -n "$WAYLAND_DISPLAY" ]; then
systemctl --user import-environment WAYLAND_DISPLAY DISPLAY DBUS_SESSION_BUS_ADDRESS 2>/dev/null
dbus-update-activation-environment --systemd WAYLAND_DISPLAY DISPLAY DBUS_SESSION_BUS_ADDRESS 2>/dev/null
fi
# Automatically start dwl on TTY 1
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
exec dwl
fi
'';
history = {
size = 10000;
save = 10000;
path = "$HOME/.local/share/zsh/history";
ignoreDups = true;
ignoreAllDups = true;
ignoreSpace = true;
share = true;
extended = true;
};
plugins = [
{
name = "fast-syntax-highlighting";
src = pkgs.zsh-fast-syntax-highlighting.src;
}
{
name = "zsh-autosuggestions";
src = pkgs.zsh-autosuggestions.src;
}
{
name = "zsh-history-substring-search";
src = pkgs.zsh-history-substring-search.src;
}
{
name = "fzf-tab";
src = pkgs.zsh-fzf-tab.src;
}
];
shellAliases = {
ls = "eza --group-directories-first";
ll = "eza -l --group-directories-first --git";
la = "eza -la --group-directories-first --git";
lt = "eza --tree --level=2";
cat = "bat --paging=never";
grep = "grep --color=auto";
gs = "git status -sb";
gd = "git diff";
gc = "git commit";
gp = "git push";
ga = "git add -A";
gm = "git add -m";
gl = "git log --oneline";
cleanup = "sudo nix-collect-garbage -d";
".." = "cd ..";
"..." = "cd ../..";
};
};
programs.starship = {
enable = true;
enableZshIntegration = true;
settings = {
add_newline = false;
command_timeout = 500;
scan_timeout = 10;
format = lib.concatStrings [
"$directory"
"$git_branch"
"$git_status"
"$nix_shell"
"$python"
"$c"
"$rust"
"$cmd_duration"
"$jobs"
"$line_break"
"$character"
];
character = {
success_symbol = "[](bold green)";
error_symbol = "[](bold red)";
vimcmd_symbol = "[](bold yellow)";
};
directory = {
style = "bold cyan";
truncation_length = 3;
truncate_to_repo = true;
truncation_symbol = "/";
read_only = " 🔒";
};
git_branch = {
style = "bold purple";
format = "[$symbol$branch]($style) ";
symbol = " ";
};
git_status = {
style = "bold red";
format = "([$all_status$ahead_behind]($style)) ";
conflicted = "=";
ahead = "\${count}";
behind = "\${count}";
diverged = "\${ahead_count}\${behind_count}";
staged = "+\${count}";
modified = "!\${count}";
untracked = "?\${count}";
stashed = "\$";
};
nix_shell = {
style = "bold blue";
format = "[$symbol$state( \($name\))]($style) ";
symbol = " ";
impure_msg = "impure";
pure_msg = "pure";
};
python = {
style = "bold yellow";
format = "[$symbol( \($virtualenv\))]($style) ";
symbol = " ";
detect_extensions = [ "py" ];
detect_files = [
"pyproject.toml"
"requirements.txt"
"uv.lock"
];
};
c = {
style = "bold dimmed white";
format = "[$symbol($version(-$name))]($style) ";
symbol = " ";
detect_extensions = [
"c"
"h"
];
};
rust = {
disabled = true;
};
cmd_duration = {
style = "bold yellow";
format = "[$duration]($style) ";
min_time = 2000;
show_notifications = false;
};
jobs = {
style = "bold blue";
symbol = "";
number_threshold = 1;
};
aws.disabled = true;
gcloud.disabled = true;
docker_context.disabled = true;
kubernetes.disabled = true;
package.disabled = true;
battery.disabled = true;
};
};
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
programs.eza = {
enable = true;
enableZshIntegration = true;
icons = "auto";
};
programs.bat = {
enable = true;
config = {
theme = "ansi";
};
};
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
programs.fzf = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
defaultCommand = "fd --type f --hidden --exclude .git";
};
};
}