Convert tmux config to Nix and personalize system configuration

This commit is contained in:
2026-04-07 04:46:00 +02:00
parent 4bdcde72eb
commit 1b69e0d2a4
10 changed files with 171 additions and 122 deletions

View File

@@ -5,15 +5,15 @@
./modules/shell.nix
./modules/editor.nix
./modules/git.nix
./modules/dev-tools.nix
./modules/tmux.nix
];
# ============================================
# Home Manager Shared Configuration
# ============================================
home.username = "youruser";
home.homeDirectory = "/home/youruser";
home.username = "eliaskohout";
home.homeDirectory = "/home/eliaskohout";
home.stateVersion = "25.11";
# Home-level packages
@@ -22,27 +22,49 @@
tree
unzip
zip
fzf
bat
exa
tldr
htop
iotop
# Container tools
podman
podman-compose
# Unstable packages (if needed)
# pkgs-unstable.some-package
];
# Environment variables
home.sessionVariables = {
EDITOR = "vim";
PAGER = "less";
EDITOR = "nvim";
SHELL = "/bin/zsh";
PAGER = "bat";
TERM = "tmux-256color";
LESSHISTFILE = "${config.xdg.cacheHome}/less/lesshst";
MANPATH = "$MANPATH:/usr/local/man";
};
home.sessionPath = [
"${config.home.homeDirectory}/.local/scripts"
"${config.home.homeDirectory}/.local/bin"
];
# Locale
home.language = {
base = "de_DE.UTF-8";
};
# Create xdg envs
xdg.enable = true;
# HM Modules
programs.fzf.enable = true;
programs.gpg.enable = true;
services.gpg-agent = {
enable = true;
enableSshSupport = true;
};
# Home Manager should manage itself
programs.home-manager.enable = true;
# Locale
home.language = {
base = "en_US.UTF-8";
};
}

View File

@@ -1,54 +0,0 @@
{ config, lib, pkgs, pkgs-unstable, ... }:
{
# Development tools at user level
home.packages = with pkgs; [
# Debuggers
lldb
gdb
# Version managers
fnm # Node version manager
pyenv # Python version manager
# Build tools
cmake
ninja
meson
# System tools
tmux
htop
iotop
# Container tools
podman
podman-compose
# Cloud/Infrastructure
# terraform
# kubectl
# helm
# Testing
# pytest # Python
# jest # JavaScript (via npm)
];
# tmux configuration (optional)
programs.tmux = {
enable = true;
baseIndex = 1;
newSessionPath = "$HOME";
shortcut = "a";
extraConfig = ''
# Enable mouse
set -g mouse on
# Vi-like navigation
setw -g mode-keys vi
'';
};
}

View File

@@ -1,7 +1,6 @@
{ config, lib, pkgs, pkgs-unstable, ... }:
{
# Neovim as primary editor
programs.neovim = {
enable = true;
defaultEditor = true;
@@ -62,8 +61,4 @@
EOF
'';
};
# Alternative: VS Code (uncomment if preferred)
# programs.vscode.enable = true;
}

View File

@@ -3,8 +3,8 @@
{
programs.git = {
enable = true;
userName = "Your Name"; # TODO: Customize
userEmail = "your.email@example.com"; # TODO: Customize
userName = "Elias Kohout";
userEmail = "elias@kohout.de";
extraConfig = {
init.defaultBranch = "main";
@@ -13,18 +13,13 @@
};
aliases = {
st = "status";
co = "checkout";
br = "branch";
ci = "commit";
unstage = "reset HEAD --";
last = "log -1 HEAD";
visual = "log --graph --oneline --all";
};
};
# GPG key signing (optional, uncomment if using)
# programs.gpg.enable = true;
# services.gpg-agent.enable = true;
# GPG key signing
programs.gpg.enable = true;
services.gpg-agent.enable = true;
}

View File

@@ -1,40 +1,38 @@
{ config, lib, pkgs, ... }:
{ config, lib, ... }:
{
programs.zsh = {
enable = true;
dotDir = ".config/zsh";
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
history = {
path = "${config.xdg.configHome}/zsh/zsh_history";
size = 10000;
save = 10000;
};
initExtra = ''
# Custom shell initialization
eval "$(direnv hook zsh)"
eval "$(starship init zsh)"
bindkey '^R' history-incremental-search-backward
bindkey '^S' history-incremental-search-forward
'';
promptInit = ''
autoload -Uz vcs_info
precmd() { vcs_info }
zstyle ':vcs_info:git:*' formats '%b'
setopt PROMPT_SUBST
PROMPT='%F{green}%n@%m%f:%F{blue}%~%f %F{240}''${vcs_info_msg_0_}%f %# '
'';
shellAliases = {
ls = "exa -l";
la = "exa -la";
tree = "exa --tree";
cat = "bat";
cd = "z";
};
};
plugins = [
{
name = "z";
src = pkgs.fetchFromGitHub {
owner = "agkozak";
repo = "zsh-z";
rev = "v1.12.0";
sha256 = "sha256-z7YhKUpn6uEEGT1iFSBpUG+w0D1M9YsvvZW8PwDh8T8=";
};
}
];
};
programs.starship.enable = true;
programs.direnv.enable = true;
programs.direnv.nix-direnv.enable = true;
home.activation.createZshHistDir = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
mkdir -p "${config.xdg.configHome}/zsh"
'';
}

101
home/modules/tmux.nix Normal file
View File

@@ -0,0 +1,101 @@
{ config, lib, pkgs, ... }:
{
programs.tmux = {
enable = true;
# Shell and terminal
shell = "${pkgs.zsh}/bin/zsh";
terminal = "tmux-256color";
terminalOverrides = [ "*256col*:Tc" ];
# Indexing
baseIndex = 1;
paneBaseIndex = 1;
renumberWindows = true;
# Mouse and clipboard
mouse = false;
setClipboard = true;
# History
historyLimit = 50000;
# Status bar
statusInterval = 1;
statusPosition = "top";
statusJustify = "left";
statusStyle = "bg=black,fg=brightwhite";
statusLeft = "#[bg=colour236,fg=brightwhite]#{?session_path, #(basename #{session_path}) ,}";
statusRight = "#[bg=colour236,fg=brightwhite] #H #[bg=colour235,fg=brightwhite] %H:%M:%S ";
statusLeftLength = 100;
statusRightLength = 100;
# Window styling
windowStatusFormat = " #[fg=white]#I:#[fg=white]#W#{?window_flags,#F,} ";
windowStatusCurrentFormat = "#[bg=colour235,fg=brightred,bold] #I:#W#{?window_flags,#F,} ";
windowStatusSeparator = "";
# Pane styling
paneActiveBorderStyle = "fg=brightred";
paneBorderStyle = "fg=colour238";
# Message styling
messageStyle = "bg=colour236,fg=brightwhite";
messageCommandStyle = "bg=colour236,fg=brightwhite";
# Mode and clock
modeStyle = "bg=brightred,fg=black";
clockModeColour = "brightred";
clockModeStyle = 24;
# Copy mode
copyMode = {
vi = true;
};
# Keybindings
keyBindings = [
{
key = "y";
command = "copy-mode";
}
{
key = "h";
command = "select-pane -L";
options = { repeat = true; };
}
{
key = "j";
command = "select-pane -D";
options = { repeat = true; };
}
{
key = "k";
command = "select-pane -U";
options = { repeat = true; };
}
{
key = "l";
command = "select-pane -R";
options = { repeat = true; };
}
{
key = "r";
command = "source-file ~/.config/tmux/tmux.conf \\; display-message \"tmux.conf reloaded\"";
options = { repeat = true; };
}
{
key = "q";
command = "display-popup -E -w 60% -h 60% -d '#{session_path}' 'nvim quicknote.md'";
}
];
# Additional settings via extraConfig
extraConfig = ''
set -ga terminal-overrides ",*256col*:Tc"
set -g focus-events on
set -g pane-border-lines heavy
'';
};
}

View File

@@ -15,7 +15,6 @@
environment.systemPackages = with pkgs; [
git
curl
wget
vim
htop
];
@@ -35,10 +34,9 @@
# System-wide locale
i18n.defaultLocale = "en_US.UTF-8";
time.timeZone = "UTC";
time.timeZone = "Europe/Berlin";
# Networking basics
networking.useDHCP = lib.mkDefault true;
networking.networkmanager.enable = lib.mkDefault false;
}

View File

@@ -15,7 +15,7 @@
languagePackages = {
rust = with pkgs; [ rustup cargo-deny cargo-edit ];
python = with pkgs; [ python3 python3Packages.pip python3Packages.virtualenv ];
python = with pkgs; [ python3 python3Packages.pip python3Packages.virtualenv uv ];
nodejs = with pkgs; [ nodejs npm pnpm ];
go = with pkgs; [ go golangci-lint ];
ruby = with pkgs; [ ruby bundler ];
@@ -35,16 +35,12 @@
gcc
clang
cmake
gdb
ripgrep
fd
jq
yq-go
] ++ selectedPackages;
# Enable container support (optional)
virtualisation.docker.enable = true;
virtualisation.docker.enableOnBoot = false;
#virtualisation.docker.enable = true;
#virtualisation.docker.enableOnBoot = false;
};
}

View File

@@ -6,7 +6,7 @@
defaultShell = lib.mkOption {
type = lib.types.str;
default = "zsh";
description = "Default shell (bash, zsh, fish)";
description = "Default shell (dash, zsh, fish)";
};
};
@@ -15,13 +15,11 @@
in lib.mkIf cfg.enable {
programs.zsh.enable = cfg.defaultShell == "zsh";
programs.bash.enable = true;
programs.dash.enable = true;
programs.fish.enable = cfg.defaultShell == "fish";
# Common shell packages
environment.systemPackages = with pkgs; [
starship
direnv
];
};

View File

@@ -7,10 +7,10 @@
config = lib.mkIf config.custom.system.enable {
# System-wide settings
system.stateVersion = "24.11";
system.stateVersion = "25.11";
# Users
users.users.youruser = {
users.users.eliaskohout = {
isNormalUser = true;
extraGroups = [ "wheel" "docker" ];
shell = pkgs.zsh;