Making additional structural changes, adding in advanced tmux configuration

This commit is contained in:
jeirmeister 2024-11-01 23:40:23 -07:00
parent 711c6eef87
commit 4f46e48abc
Signed by: jeirmeister
GPG Key ID: 33A40DF62D35C4A7
33 changed files with 409 additions and 349 deletions

View File

@ -10,7 +10,7 @@
git
git-credential-manager
gh
ttyd
gotty
git-crypt
sops
];

View File

@ -1,10 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./go
./javascript
./python
./rust
];
}

View File

@ -1,7 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./tools.nix
];
}

View File

@ -1,8 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./node.nix
./package-managers
];
}

View File

@ -1,14 +0,0 @@
{ config, pkgs, ... }:
let
nodeVersion = if builtins.getEnv "NODE_VERSION" != "" then builtins.getEnv "NODE_VERSION" else "20";
in
{
home.packages = [
pkgs."nodejs_${nodeVersion}"
];
home.sessionVariables = {
NODE_PATH = "${config.home.sessionVariables.NODE_PACKAGES_DIR}/lib/node_modules";
};
}

View File

@ -1,9 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./npm.nix
./pnpm.nix
./yarn.nix
];
}

View File

@ -1,13 +0,0 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
nodePackages.npm
nodePackages.node-gyp
nodePackages.node-pre-gyp
];
home.file.".npmrc".text = ''
prefix=${config.home.sessionVariables.NODE_PACKAGES_DIR}
'';
}

View File

@ -1,10 +0,0 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [ nodePackages.pnpm ];
home.file.".pnpmrc".text = ''
pnpm-version=8.9.0
store-dir=${config.home.sessionVariables.XDG_DATA_HOME}/pnpm
'';
}

View File

@ -1,9 +0,0 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [ yarn ];
home.file.".yarnrc".text = ''
cache-folder "${config.home.sessionVariables.XDG_CACHE_HOME}/yarn"
'';
}

View File

@ -1,28 +0,0 @@
{ pkgs, ... }:
let
pythonVersion = builtins.replaceStrings [ "." ] [ "" ] (
if builtins.getEnv "PYTHON_VERSION" != "" then builtins.getEnv "PYTHON_VERSION" else "311"
);
in
{
home.packages = [
pkgs."python${pythonVersion}"
pkgs."python${pythonVersion}Packages"."pip"
pkgs."python${pythonVersion}Packages"."setuptools"
pkgs."python${pythonVersion}Packages"."wheel"
pkgs."python${pythonVersion}Packages"."black"
pkgs."python${pythonVersion}Packages"."pylint"
pkgs."python${pythonVersion}Packages"."mypy"
pkgs."python${pythonVersion}Packages"."pytest"
pkgs."python${pythonVersion}Packages"."pytest-cov"
pkgs."python${pythonVersion}Packages"."toggl-cli"
];
home.sessionVariables = {
PYTHONDONTWRITEBYTECODE = 1;
PYTHONIOENCODING = "UTF-8";
VIRTUAL_ENV_DISABLE_PROMPT = 1;
};
}

View File

@ -1,8 +0,0 @@
{ pkgs, ... }:
{
imports = [
./base.nix
./package-managers
];
}

View File

@ -1,10 +0,0 @@
# Add to env/languages/python/package-managers/default.nix
{ config, pkgs, ... }:
{
imports = [
./pipenv.nix
./poetry
];
}

View File

@ -1,14 +0,0 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [ pipenv ];
home.sessionVariables = {
PIPENV_VENV_IN_PROJECT = "1";
WORKON_HOME = "${config.home.sessionVariables.VIRTUALENV_HOME}";
PIP_NO_CACHE_DIR = "off";
PIPENV_SKIP_LOCK = "1";
PIPENV_IGNORE_VIRTUALENVS = "1";
PIPENV_MAX_DEPTH = "5";
};
}

View File

@ -1,32 +0,0 @@
{ config, pkgs, ... }:
let
poetry2nix = import (pkgs.fetchFromGitHub {
owner = "nix-community";
repo = "poetry2nix";
rev = "1.0.0";
sha256 = "15mdb0lr7027qpm9s1v1d9sdb8abmcdrpqsv4zvinif8a8liqxkq";
}) { inherit pkgs; };
in
{
home.packages = with pkgs; [
poetry
];
imports = [
./packages
];
home.sessionVariables = {
POETRY_VIRTUALENVS_IN_PROJECT = "true";
POETRY_CACHE_DIR = "${config.home.sessionVariables.XDG_CACHE_HOME}/pypoetry";
};
home.file.".config/pypoetry/config.toml".text = ''
[virtualenvs]
in-project = true
path = "${config.home.sessionVariables.VIRTUALENV_HOME}/poetry"
create = true
clear = false
'';
}

View File

@ -1,10 +0,0 @@
{ config, pkgs, ... }:
let
repo-to-text = pkgs.callPackage ./repo-to-text.nix { };
in
{
home.packages = [
repo-to-text
];
}

View File

@ -1,18 +0,0 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
cargo-edit
cargo-watch
cargo-audit
cargo-tarpaulin
];
home.file.".cargo/config.toml".text = ''
[build]
target-dir = "target"
[cargo-new]
vcs = "git"
'';
}

View File

@ -1,8 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./cargo.nix
./toolchain.nix
];
}

View File

@ -1,4 +1,4 @@
{ lib, pkgs, ... }:
{ config, lib, pkgs, ... }:
let
sharedShellOptions = {
@ -8,10 +8,23 @@ let
};
shellAliases = {
# System management
ll = "ls -la";
update = "sudo nixos-rebuild switch";
# Home manager
hm = "home-manager";
hms = "home-manager switch";
# Tmux
ta = "tmux attach -t";
tl = "tmux list-sessions";
tn = "tmux new-session -s";
"tmux-help" = "bat ${config.xdg.configHome}/tmux/tmux-man.md --plain";
"save-session" = "tmux command-prompt -p 'Command:' 'run-shell \"${pkgs.tmuxPlugins.resurrect}/share/tmux-plugins/resurrect/scripts/save.sh\"'";
"restore-session" = "tmux command-prompt -p 'Command:' 'run-shell \"${pkgs.tmuxPlugins.resurrect}/share/tmux-plugins/resurrect/scripts/restore.sh\"'";
"yank-text" = "tmux command-prompt -p 'Command:' 'run-shell \"tmux show-buffer | ${pkgs.xclip}/bin/xclip -selection clipboard\"'";
};
initExtra = ''
@ -26,33 +39,126 @@ let
in
{
imports = [
./tmux.nix
./utilities.nix
# Language Support
./go.nix
./javascript.nix
./python.nix
./rust.nix
];
home.sessionVariables = sharedShellOptions.sessionVariables;
programs.bash = {
enable = true;
initExtra = sharedShellOptions.initExtra;
};
programs.zsh = {
enable = true;
autosuggestion.enable = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
oh-my-zsh = {
programs = {
# Shell configurations
bash = {
enable = true;
theme = "robbyrussell";
plugins = [
"git"
"docker"
"kubectl"
initExtra = sharedShellOptions.initExtra;
};
zsh = {
enable = true;
autosuggestion.enable = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
oh-my-zsh = {
enable = true;
theme = "robbyrussell";
plugins = [
"git" # Adds many git aliases and functions
"docker" # Docker aliases and completion
"kubectl" # Kubernetes aliases and completion
"tmux" # Tmux integration and aliases
"fzf" # Fuzzy finder integration
"dirhistory" # Keyboard shortcuts for directory navigation
"history" # Command history searching
"copypath" # Copy current directory path
"copyfile" # Copy file contents
"extract" # Extract any archive format
];
};
initExtra = sharedShellOptions.initExtra;
};
# System utilities
fzf = {
enable = true;
enableZshIntegration = true;
defaultCommand = "rg --files --hidden --follow";
defaultOptions = [
"--height 40%"
"--layout=reverse"
"--border"
];
};
initExtra = sharedShellOptions.initExtra;
htop = {
enable = true;
settings = {
color_scheme = 6;
cpu_count_from_one = 0;
delay = 15;
highlight_base_name = 1;
highlight_threads = 1;
show_program_path = 0;
tree_view = 1;
};
};
};
home.packages = with pkgs; [
# System Monitoring and Process Management
htop
btop
# Search and Navigation Tools
ripgrep # Fast searching
fd # Alternative to find
fzf # Fuzzy finder
tree # Directory structure viewer
# File Management and Manipulation
jq # JSON processor
bat # Better cat
xclip # Clipboard management
unzip
p7zip
file
# Development Tools
git
git-credential-manager
gh # GitHub CLI
# Network Analysis and Management
mtr # Network diagnostic tool
iperf3 # Network performance tool
nmap # Network scanner
tailscale # VPN service
# Communication Tools
signal-cli
signal-export
whatsapp-chat-exporter
discordo
telegram-bot-api
tg
# Task & Time Management
todoist # CLI version
bitwarden-cli
# System Information and Documentation
neofetch # System information
tldr # Simplified man pages
# AppImage Support
appimage-run
zlib
fuse
fuse3
];
xdg.enable = true;
}

View File

@ -0,0 +1,26 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
nodePackages.npm
nodePackages.node-gyp
nodePackages.node-pre-gyp
nodePackages.pnpm
yarn
];
home.file.".npmrc".text = ''
prefix=${config.home.sessionVariables.NODE_PACKAGES_DIR}
'';
home.file.".pnpmrc".text = ''
pnpm-version=8.9.0
store-dir=${config.home.sessionVariables.XDG_DATA_HOME}/pnpm
'';
home.file.".yarnrc".text = ''
cache-folder "${config.home.sessionVariables.XDG_CACHE_HOME}/yarn"
'';
}

View File

@ -0,0 +1,39 @@
{ config, pkgs, ... }:
let
pythonVersion = builtins.replaceStrings [ "." ] [ "" ] config.home.sessionVariables.PYTHON_VERSION;
pythonPackages = pkgs."python${pythonVersion}Packages";
# import custom packages
repo-to-text = pkgs.callPackage ./repo-to-text.nix { };
in
{
home.sessionVariables = {
PYTHONDONTWRITEBYTECODE = 1;
PYTHONIOENCODING = "UTF-8";
VIRTUAL_ENV_DISABLE_PROMPT = 1;
};
home.packages = with pythonPackages; [
pip
setuptools
wheel
black
pylint
mypy
pytest
pytest-cov
# Time tracking
toggl-cli
# Add other Python CLI tools
httpie # HTTP client
youtube-dl # Video downloader
# Custom CLI tools
repo-to-text
];
}

View File

@ -1,14 +1,28 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
rustup
];
home.sessionVariables = {
RUSTUP_HOME = "${config.home.sessionVariables.XDG_DATA_HOME}/rustup";
};
home.packages = with pkgs; [
cargo-edit
cargo-watch
cargo-audit
cargo-tarpaulin
rustup
];
home.file.".cargo/config.toml".text = ''
[build]
target-dir = "target"
[cargo-new]
vcs = "git"
'';
home.file.".rustup/settings.toml".text = ''
default_toolchain = "${config.home.sessionVariables.RUST_VERSION}"
profile = "default"

View File

@ -1,29 +0,0 @@
{ config, pkgs, ... }:
{
programs.tmux = {
enable = true;
clock24 = true;
baseIndex = 1;
escapeTime = 0;
terminal = "screen-256color";
historyLimit = 10000;
keyMode = "vi";
customPaneNavigationAndResize = true;
extraConfig = ''
# Enable mouse support
set -g mouse on
# Set prefix to Ctrl-a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Split panes using | and -
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
'';
};
}

View File

@ -1,87 +0,0 @@
{ config
, pkgs
, lib
, ...
}:
{
# FZF (Fuzzy Finder) configuration
programs.fzf = {
enable = true;
enableZshIntegration = true;
defaultCommand = "rg --files --hidden --follow";
defaultOptions = [
"--height 40%"
"--layout=reverse"
"--border"
];
};
# Htop configuration
programs.htop = {
enable = true;
settings = {
color_scheme = 6;
cpu_count_from_one = 0;
delay = 15;
highlight_base_name = 1;
highlight_threads = 1;
show_program_path = 0;
tree_view = 1;
};
};
home.packages = with pkgs; [
# System Monitoring and Process Management
htop
btop
# Search and Navigation Tools
ripgrep # Fast searching
fd # Alternative to find
fzf # Fuzzy finder
tree # Directory structure viewer
# File Management and Manipulation
jq # JSON processor
bat # Better cat
xclip # Clipboard management
unzip
p7zip
file
# Development Tools
git
git-credential-manager
gh # GitHub CLI
# Network Analysis and Management
mtr # Network diagnostic tool
iperf3 # Network performance tool
nmap # Network scanner
tailscale # VPN service
# Communication Tools
signal-cli
signal-export
whatsapp-chat-exporter
discordo
telegram-bot-api
tg
# Task & Time Management
todoist
# System Information and Documentation
neofetch # System information
tldr # Simplified man pages
# AppImage Support
appimage-run
zlib
fuse
fuse3
];
xdg.enable = true;
}

View File

@ -0,0 +1,135 @@
{ config, pkgs, ... }:
{
programs.tmux = {
enable = true;
clock24 = true;
baseIndex = 1;
escapeTime = 0;
terminal = "screen-256color";
historyLimit = 50000;
keyMode = "vi";
customPaneNavigationAndResize = true;
plugins = with pkgs.tmuxPlugins; [
{
plugin = sensible;
extraConfig = ''
# Set default shell to zsh
set -g default-command "${pkgs.zsh}/bin/zsh"
'';
}
{
plugin = resurrect;
extraConfig = ''
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-dir '${config.xdg.dataHome}/tmux/resurrect'
bind C-s run-shell ${pkgs.tmuxPlugins.resurrect}/share/tmux-plugins/resurrect/scripts/save.sh
bind C-r run-shell ${pkgs.tmuxPlugins.resurrect}/share/tmux-plugins/resurrect/scripts/restore.sh
'';
}
{
plugin = continuum;
extraConfig = ''
set -g @continuum-restore 'on'
set -g @continuum-save-interval '15'
set -g @continuum-boot 'on'
'';
}
{
plugin = better-mouse-mode;
extraConfig = ''
set -g @scroll-speed-num-lines-per-scroll 1
'';
}
{
plugin = yank;
extraConfig = ''
set -g @yank_selection 'clipboard'
set -g @yank_selection_mouse 'clipboard'
'';
}
{
plugin = pain-control;
extraConfig = ''
bind C-h select-pane -L
bind C-j select-pane -D
bind C-k select-pane -U
bind C-l select-pane -R
'';
}
{
plugin = sidebar;
extraConfig = ''
set -g @sidebar-tree-command 'tree -C'
bind Tab run-shell ${pkgs.tmuxPlugins.sidebar}/share/tmux-plugins/sidebar/scripts/toggle.sh
bind BSpace run-shell ${pkgs.tmuxPlugins.sidebar}/share/tmux-plugins/sidebar/scripts/toggle.sh
'';
}
{
plugin = online-status;
extraConfig = ''
set -g @online_icon ""
set -g @offline_icon ""
'';
}
{
plugin = cpu;
extraConfig = ''
set -g @cpu_percentage_format "%3.0f%%"
'';
}
{
plugin = battery;
extraConfig = ''
set -g @battery_percentage_format "%3.0f%%"
'';
}
{
plugin = fzf-url;
extraConfig = ''
set -g @fzf-url-bind 'u'
'';
}
{
plugin = logging;
extraConfig = ''
set -g @logging-path "${config.xdg.dataHome}/tmux/logging"
bind P pipe-pane -o "cat >>#{@logging-path}/tmux-#W.log" \; display "Toggled logging to #{@logging-path}/tmux-#W.log"
'';
}
{
plugin = fingers;
extraConfig = ''
set -g @fingers-key f
set -g @fingers-pattern-0 '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}'
'';
}
];
extraConfig = ''
# Set prefix
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Mouse support
set -g mouse on
# Status bar configuration
set -g status-interval 1
set -g status-position top
set -g status-justify left
set -g status-left "#{online_status} #[fg=green]#S #[fg=yellow]#I #[fg=cyan]#P"
set -g status-right "#{cpu_fg_color}#{cpu_percentage} #[fg=colour136]#{battery_percentage} %H:%M:%S"
# Natural language command bindings
bind : command-prompt -p "Command:" {
if -F "#{m:save-session,%%}" "run-shell ${pkgs.tmuxPlugins.resurrect}/share/tmux-plugins/resurrect/scripts/save.sh" \
if -F "#{m:restore-session,%%}" "run-shell ${pkgs.tmuxPlugins.resurrect}/share/tmux-plugins/resurrect/scripts/restore.sh" \
if -F "#{m:yank-text,%%}" "run-shell 'tmux show-buffer | ${pkgs.xclip}/bin/xclip -selection clipboard'"
}
'';
};
}

View File

@ -0,0 +1,56 @@
% TMUX-PLUGINS(1) Custom Tmux Plugins Help | November 2024
# NAME
tmux-plugins - Overview of custom Tmux plugins, keybindings, and natural language commands
# SYNOPSIS
This man page provides an overview of custom Tmux plugins, their purpose, example usage, and natural language commands.
# PREFIX KEY
The prefix key for all tmux commands is `Ctrl-a` (C-a). This means whenever you see `Prefix + key`, you should:
1. Press and hold `Ctrl`, then press `a`
2. Release both keys
3. Press the specified key
# DESCRIPTION
The following is a list of Tmux plugins installed through Home Manager in your environment, along with their purpose, example usage, and custom commands.
# PLUGINS
## 1. Sensible
- **Purpose**: Provides a set of sensible default configurations for tmux.
- **Example Usage**:
- Automatically enabled with better key bindings and options
- Uses zsh as the default shell
## 2. Resurrect
- **Purpose**: Saves and restores your Tmux sessions, including windows, panes, and running processes.
- **Example Usage**:
- Save session: `Prefix + Ctrl-s`
- Restore session: `Prefix + Ctrl-r`
- **Natural Language Command**:
- `save-session`: Saves the current session.
- `restore-session`: Restores the last saved session.
[rest of plugins remain the same until NATURAL LANGUAGE COMMANDS section]
# NATURAL LANGUAGE COMMANDS
In addition to keybindings, you can use these natural language commands from within tmux:
1. `save-session`: Saves the current tmux session using Resurrect.
2. `restore-session`: Restores the last saved tmux session using Resurrect.
3. `yank-text`: Copies selected text to the system clipboard using Yank.
These commands can be typed directly into tmux's command prompt (`Prefix + :`) or used as shell aliases.
Note: Plugin management is handled through Home Manager, so there's no need for manual plugin installation or updates.
# QUICK REFERENCE
You can access this manual at any time by typing `tmux-help` in your terminal.
# SEE ALSO
tmux(1), man(1)
# AUTHOR
Custom man page created for user-defined Tmux configuration with natural language commands.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACD04ZD4g8/TdqC+MqnlSIWHTNMExpPcR9xoxXcb0p7WsAAAAJhsVPSrbFT0
qwAAAAtzc2gtZWQyNTUxOQAAACD04ZD4g8/TdqC+MqnlSIWHTNMExpPcR9xoxXcb0p7WsA
AAAEDuUdKAVQz7X+5rGyfRO7yardCsauFdRXJ0/gQpIHSIo/ThkPiDz9N2oL4yqeVIhYdM
0wTGk9xH3GjFdxvSntawAAAAEWplaXJtZWlzdGVyQG5peG9zAQIDBA==
-----END OPENSSH PRIVATE KEY-----

View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPThkPiDz9N2oL4yqeVIhYdM0wTGk9xH3GjFdxvSntaw jeirmeister@nixos