rearrange and refactor multiple modules

This commit is contained in:
Yan Lin 2026-02-11 20:08:30 +01:00
parent 622265bd6e
commit be7cee9208
13 changed files with 233 additions and 456 deletions

View file

@ -9,17 +9,13 @@
../../modules/ssh.nix
../../modules/git.nix
../../modules/lazygit.nix
../../modules/rsync.nix
../../modules/btop.nix
../../modules/firefox/home.nix
../../modules/ghostty.nix
../../modules/syncthing.nix
../../modules/claude-code.nix
../../modules/tex.nix
../../modules/media/tool.nix
../../modules/font/home.nix
../../modules/aerospace.nix
../../modules/peripheral/home.nix
];
nixpkgs.config.allowUnfree = true;
@ -154,26 +150,20 @@
home.packages = with pkgs; [
texlive.combined.scheme-full
# Network and file transfer
lftp
httpie
gnumake
# Network diagnostic tools
bind # DNS utilities (dig, nslookup, mdig)
inetutils # Network utilities (telnet)
netcat-gnu # Network connection utility
curl # HTTP client
wget # Web downloader
bandwhich # Terminal bandwidth utilization tool
# Command-line utilities
ncdu
delta
fastfetch
coreutils # GNU core utilities (base64, etc.)
duti # Set default applications for file types (macOS)
rsync
];
# Startup applications via launchd agents
@ -317,4 +307,78 @@
run ${pkgs.duti}/bin/duti -s com.colliderli.iina .ogg all
run ${pkgs.duti}/bin/duti -s com.colliderli.iina .opus all
'';
home.file.".config/linearmouse/linearmouse.json".text = builtins.toJSON {
"$schema" = "https://app.linearmouse.org/schema/0.10.0";
schemes = [{
"if" = {
device.category = "mouse";
};
scrolling.reverse.vertical = true;
pointer = {
acceleration = 0;
speed = 0.6;
};
}];
};
home.file.".aerospace.toml".text = ''
# Make all new windows floating by default
[[on-window-detected]]
run = ['layout floating']
[mode.main.binding]
alt-enter = 'layout floating tiling'
alt-f = 'fullscreen'
alt-q = 'close'
# Window focus (vim-style)
alt-h = 'focus left'
alt-j = 'focus down'
alt-k = 'focus up'
alt-l = 'focus right'
# Move windows
alt-shift-h = 'move left'
alt-shift-j = 'move down'
alt-shift-k = 'move up'
alt-shift-l = 'move right'
# Resize
alt-minus = 'resize smart -50'
alt-equal = 'resize smart +50'
# Workspaces
alt-1 = 'workspace 1'
alt-2 = 'workspace 2'
alt-3 = 'workspace 3'
alt-4 = 'workspace 4'
alt-5 = 'workspace 5'
alt-6 = 'workspace 6'
alt-7 = 'workspace 7'
alt-8 = 'workspace 8'
alt-9 = 'workspace 9'
alt-0 = 'workspace 10'
# Focus monitor
alt-comma = 'focus-monitor prev'
alt-period = 'focus-monitor next'
# Move window to monitor
alt-shift-comma = 'move-node-to-monitor prev'
alt-shift-period = 'move-node-to-monitor next'
# Move window to workspace
alt-shift-1 = ['move-node-to-workspace 1', 'workspace 1']
alt-shift-2 = ['move-node-to-workspace 2', 'workspace 2']
alt-shift-3 = ['move-node-to-workspace 3', 'workspace 3']
alt-shift-4 = ['move-node-to-workspace 4', 'workspace 4']
alt-shift-5 = ['move-node-to-workspace 5', 'workspace 5']
alt-shift-6 = ['move-node-to-workspace 6', 'workspace 6']
alt-shift-7 = ['move-node-to-workspace 7', 'workspace 7']
alt-shift-8 = ['move-node-to-workspace 8', 'workspace 8']
alt-shift-9 = ['move-node-to-workspace 9', 'workspace 9']
alt-shift-0 = ['move-node-to-workspace 10', 'workspace 10']
'';
}

View file

@ -3,7 +3,6 @@
{
imports = [
../../modules/homebrew.nix
../../modules/peripheral/system.nix
nix-homebrew.darwinModules.nix-homebrew
];
@ -25,34 +24,31 @@
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
];
# System configuration
system.stateVersion = 6;
nixpkgs.hostPlatform = "aarch64-darwin";
programs.zsh.enable = true;
# Set primary user for system preferences
system.primaryUser = "yanlin";
# Security configuration - passwordless sudo for yanlin
security.sudo.extraConfig = ''
yanlin ALL=(ALL) NOPASSWD: ALL
'';
system.defaults = {
dock = {
autohide = true; # Automatically hide and show the dock
autohide-delay = 0.2; # Delay before showing the dock (in seconds)
autohide-time-modifier = 0.5; # Animation duration for dock show/hide
orientation = "bottom"; # Dock position: "bottom", "left", or "right"
tilesize = 48; # Size of dock icons (16-128)
magnification = false; # Enable magnification when hovering
minimize-to-application = false; # Minimize windows to application icon
show-recents = true; # Show recent applications in dock
show-process-indicators = true; # Show dots under running apps
static-only = false; # Show only open applications
mru-spaces = false; # Automatically rearrange spaces based on use
expose-animation-duration = 0.5; # Mission Control animation speed
dashboard-in-overlay = false; # Show Dashboard as overlay
autohide = true;
autohide-delay = 0.2;
autohide-time-modifier = 0.5;
orientation = "bottom";
tilesize = 48;
magnification = false;
minimize-to-application = false;
show-recents = true;
show-process-indicators = true;
static-only = false;
mru-spaces = false;
expose-animation-duration = 0.5;
dashboard-in-overlay = false;
persistent-apps = [
"/Applications/Ghostty.app"
"/Applications/Firefox.app"
@ -61,73 +57,65 @@
];
persistent-others = [
"/Users/yanlin/Downloads"
]; # List of folders/files to keep in dock
];
# Hot Corners - Actions:
# 1 = Disabled, 2 = Mission Control, 3 = Application Windows,
# 4 = Desktop, 5 = Start Screen Saver, 6 = Disable Screen Saver,
# 7 = Dashboard, 10 = Put Display to Sleep, 11 = Launchpad,
# 12 = Notification Center, 13 = Lock Screen, 14 = Quick Note
wvous-tl-corner = 1; # Top left corner action
wvous-tr-corner = 1; # Top right corner action
wvous-bl-corner = 1; # Bottom left corner action
wvous-br-corner = 1; # Bottom right corner action
wvous-tl-corner = 1;
wvous-tr-corner = 1;
wvous-bl-corner = 1;
wvous-br-corner = 1;
};
finder = {
AppleShowAllExtensions = true; # Show all file extensions
AppleShowAllFiles = false; # Show hidden files
CreateDesktop = false; # Show icons on desktop
FXEnableExtensionChangeWarning = false; # Warn when changing file extension
FXPreferredViewStyle = "Nlsv"; # Default view: "icnv"=Icon, "Nlsv"=List, "clmv"=Column, "glyv"=Gallery
QuitMenuItem = false; # Allow quitting Finder with ⌘Q
ShowPathbar = true; # Show path bar at bottom
ShowStatusBar = false; # Show status bar at bottom
_FXShowPosixPathInTitle = false; # Show full POSIX path in title
_FXSortFoldersFirst = true; # Sort folders before files
AppleShowAllExtensions = true;
AppleShowAllFiles = false;
CreateDesktop = false;
FXEnableExtensionChangeWarning = false;
FXPreferredViewStyle = "Nlsv";
QuitMenuItem = false;
ShowPathbar = true;
ShowStatusBar = false;
_FXShowPosixPathInTitle = false;
_FXSortFoldersFirst = true;
};
# --------------------------------------------------------------------------
# Global Domain Settings (NSGlobalDomain)
# --------------------------------------------------------------------------
NSGlobalDomain = {
AppleInterfaceStyle = "Dark"; # Dark mode: "Dark" or remove for light
AppleInterfaceStyleSwitchesAutomatically = false; # Auto switch dark/light
NSAutomaticWindowAnimationsEnabled = true; # Window animations
NSDocumentSaveNewDocumentsToCloud = false; # Save to iCloud by default
NSNavPanelExpandedStateForSaveMode = true; # Expand save panel by default
PMPrintingExpandedStateForPrint = true; # Expand print panel by default
NSTableViewDefaultSizeMode = 2; # Sidebar icon size: 1=small, 2=medium, 3=large
AppleShowScrollBars = "WhenScrolling"; # "WhenScrolling", "Automatic", or "Always"
NSScrollAnimationEnabled = true; # Smooth scrolling
NSWindowResizeTime = 0.2; # Window resize animation duration
_HIHideMenuBar = false; # Auto-hide menu bar
AppleInterfaceStyle = "Dark";
AppleInterfaceStyleSwitchesAutomatically = false;
NSAutomaticWindowAnimationsEnabled = true;
NSDocumentSaveNewDocumentsToCloud = false;
NSNavPanelExpandedStateForSaveMode = true;
PMPrintingExpandedStateForPrint = true;
NSTableViewDefaultSizeMode = 2;
AppleShowScrollBars = "WhenScrolling";
NSScrollAnimationEnabled = true;
NSWindowResizeTime = 0.2;
_HIHideMenuBar = false;
NSAutomaticCapitalizationEnabled = false; # Disable automatic capitalization
NSAutomaticDashSubstitutionEnabled = false; # Disable smart dashes
NSAutomaticPeriodSubstitutionEnabled = false; # Disable automatic period with double-space
NSAutomaticQuoteSubstitutionEnabled = false; # Disable smart quotes
NSAutomaticSpellingCorrectionEnabled = false; # Disable auto-correction
NSAutomaticInlinePredictionEnabled = false; # Disable inline predictive text
"com.apple.keyboard.fnState" = false; # Use F1, F2, etc. as standard function keys
NSAutomaticCapitalizationEnabled = false;
NSAutomaticDashSubstitutionEnabled = false;
NSAutomaticPeriodSubstitutionEnabled = false;
NSAutomaticQuoteSubstitutionEnabled = false;
NSAutomaticSpellingCorrectionEnabled = false;
NSAutomaticInlinePredictionEnabled = false;
"com.apple.keyboard.fnState" = false;
};
screencapture = {
disable-shadow = false; # Disable shadow in screenshots
location = "~/Media/dcim-consume/"; # Default save location
type = "png"; # Screenshot format: png, jpg, pdf, etc.
show-thumbnail = true; # Show thumbnail after taking screenshot
disable-shadow = false;
location = "~/Media/dcim-consume/";
type = "png";
show-thumbnail = true;
};
loginwindow = {
GuestEnabled = false; # Disable guest account
ShutDownDisabled = false; # Allow shutdown from login window
RestartDisabled = false; # Allow restart from login window
SleepDisabled = false; # Allow sleep from login window
GuestEnabled = false;
ShutDownDisabled = false;
RestartDisabled = false;
SleepDisabled = false;
};
spaces = {
spans-displays = false; # Each display has separate spaces
spans-displays = false;
};
};
@ -138,4 +126,20 @@
/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
'';
launchd.user.agents.remap-keys = {
serviceConfig = {
ProgramArguments = [
"/usr/bin/hidutil"
"property"
"--set"
''{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x7000000E0},{"HIDKeyboardModifierMappingSrc":0x7000000E4,"HIDKeyboardModifierMappingDst":0x700000039}]}''
];
RunAtLoad = true;
KeepAlive = false;
Label = "org.nixos.remap-keys";
StandardErrorPath = "/tmp/remap-keys.err";
StandardOutPath = "/tmp/remap-keys.out";
};
};
}

View file

@ -9,7 +9,6 @@
../../modules/ssh.nix
../../modules/git.nix
../../modules/lazygit.nix
../../modules/rsync.nix
../../modules/btop.nix
../../modules/font/home.nix
];
@ -38,18 +37,13 @@
};
home.packages = with pkgs; [
# Network and file transfer
lftp
httpie
gnumake
# Network diagnostic tools
rsync
bind # DNS utilities (dig, nslookup, mdig)
iputils # Core network tools (ping, traceroute)
inetutils # Network utilities (telnet)
netcat-gnu # Network connection utility
# Command-line utilities
ncdu
delta
fastfetch

View file

@ -1,62 +0,0 @@
{ config, pkgs, lib, ... }:
{
home.file.".aerospace.toml".text = ''
# Make all new windows floating by default
[[on-window-detected]]
run = ['layout floating']
[mode.main.binding]
alt-enter = 'layout floating tiling'
alt-f = 'fullscreen'
alt-q = 'close'
# Window focus (vim-style)
alt-h = 'focus left'
alt-j = 'focus down'
alt-k = 'focus up'
alt-l = 'focus right'
# Move windows
alt-shift-h = 'move left'
alt-shift-j = 'move down'
alt-shift-k = 'move up'
alt-shift-l = 'move right'
# Resize
alt-minus = 'resize smart -50'
alt-equal = 'resize smart +50'
# Workspaces
alt-1 = 'workspace 1'
alt-2 = 'workspace 2'
alt-3 = 'workspace 3'
alt-4 = 'workspace 4'
alt-5 = 'workspace 5'
alt-6 = 'workspace 6'
alt-7 = 'workspace 7'
alt-8 = 'workspace 8'
alt-9 = 'workspace 9'
alt-0 = 'workspace 10'
# Focus monitor
alt-comma = 'focus-monitor prev'
alt-period = 'focus-monitor next'
# Move window to monitor
alt-shift-comma = 'move-node-to-monitor prev'
alt-shift-period = 'move-node-to-monitor next'
# Move window to workspace
alt-shift-1 = ['move-node-to-workspace 1', 'workspace 1']
alt-shift-2 = ['move-node-to-workspace 2', 'workspace 2']
alt-shift-3 = ['move-node-to-workspace 3', 'workspace 3']
alt-shift-4 = ['move-node-to-workspace 4', 'workspace 4']
alt-shift-5 = ['move-node-to-workspace 5', 'workspace 5']
alt-shift-6 = ['move-node-to-workspace 6', 'workspace 6']
alt-shift-7 = ['move-node-to-workspace 7', 'workspace 7']
alt-shift-8 = ['move-node-to-workspace 8', 'workspace 8']
alt-shift-9 = ['move-node-to-workspace 9', 'workspace 9']
alt-shift-0 = ['move-node-to-workspace 10', 'workspace 10']
'';
}

View file

@ -3,80 +3,65 @@
{
programs.btop = {
enable = true;
settings = {
# Theme and Visual Settings (Gruvbox Dark to match nvim/tmux)
color_theme = "gruvbox_dark";
theme_background = false; # Transparent background
truecolor = true; # 24-bit color support
rounded_corners = true; # Modern rounded appearance
graph_symbol = "braille"; # High-resolution graph symbols
# Vim-style Navigation
vim_keys = true; # Enable h,j,k,l,g,G navigation
# Performance and Update Settings
update_ms = 1000; # Faster updates (1 second)
background_update = true; # Continue updating when not focused
# CPU Display Settings
cpu_single_graph = false; # Show per-core graphs
cpu_graph_upper = "total"; # Upper graph shows total usage
cpu_graph_lower = "total"; # Lower graph shows total usage
cpu_invert_lower = true; # Invert lower graph for better visualization
show_uptime = true; # Display system uptime
show_cpu_freq = true; # Show CPU frequency
check_temp = true; # Monitor CPU temperature
show_coretemp = true; # Display core temperatures
temp_scale = "celsius"; # Use Celsius for temperature
cpu_sensor = "Auto"; # Auto-detect temperature sensors
# Process Display Settings
proc_sorting = "cpu lazy"; # Sort by CPU usage, lazy update
proc_tree = false; # Show process hierarchy
proc_colors = true; # Colorize process list
proc_gradient = true; # Use gradient colors for processes
proc_per_core = false; # Don't show per-core process usage
proc_mem_bytes = true; # Show memory in bytes
show_init = false; # Hide init processes
# Memory Settings
mem_graphs = true; # Show memory graphs
show_swap = true; # Display swap usage
swap_disk = true; # Show swap as disk usage
# Disk Settings
show_disks = true; # Display disk usage
use_fstab = false; # Don't use fstab for disk detection
disks_filter = ""; # No disk filtering
# Network Settings
net_download = 100; # Network download scale (Mbps)
net_upload = 100; # Network upload scale (Mbps)
net_auto = true; # Auto-scale network graphs
net_sync = false; # Don't sync download/upload scales
net_iface = ""; # Auto-detect network interface
# Battery Settings (MacBook Air)
show_battery = true; # Show battery status
# GPU Settings (system-specific)
show_gpu_info = "Auto"; # Auto-detect GPU (works on Linux with Intel/AMD/NVIDIA)
nvml_measure_pcie_speeds = false; # NVIDIA-specific, disabled for compatibility
gpu_mirror_graph = true; # Mirror GPU graph when available
# Layout Settings (platform-aware)
# Note: GPU box only shown on Linux where GPU monitoring is fully supported
# Darwin has limited GPU support (basic metrics only)
theme_background = false;
truecolor = true;
rounded_corners = true;
graph_symbol = "braille";
vim_keys = true;
update_ms = 1000;
background_update = true;
cpu_single_graph = false;
cpu_graph_upper = "total";
cpu_graph_lower = "total";
cpu_invert_lower = true;
show_uptime = true;
show_cpu_freq = true;
check_temp = true;
show_coretemp = true;
temp_scale = "celsius";
cpu_sensor = "Auto";
proc_sorting = "cpu lazy";
proc_tree = false;
proc_colors = true;
proc_gradient = true;
proc_per_core = false;
proc_mem_bytes = true;
show_init = false;
mem_graphs = true;
show_swap = true;
swap_disk = true;
show_disks = true;
use_fstab = false;
disks_filter = "";
net_download = 100;
net_upload = 100;
net_auto = true;
net_sync = false;
net_iface = "";
show_battery = true;
show_gpu_info = "Auto";
nvml_measure_pcie_speeds = false;
gpu_mirror_graph = true;
shown_boxes = "cpu mem net proc gpu";
presets = "cpu:1:default,proc:0:default cpu:0:default,mem:0:default,net:0:default cpu:0:block,net:0:tty";
# Clock Display
draw_clock = "%X"; # Display time in HH:MM:SS format
# Miscellaneous
force_tty = false; # Don't force TTY mode
custom_cpu_name = ""; # Use detected CPU name
draw_clock = "%X";
force_tty = false;
custom_cpu_name = "";
};
};
}

View file

@ -46,75 +46,51 @@ in
programs.ghostty = {
enable = true;
package = cfg.package;
settings = mkMerge [
{
# Font settings with CJK fallback
font-family = [
"JetBrainsMono Nerd Font Mono" # Primary font for Latin + symbols
"Noto Sans CJK SC" # Simplified Chinese fallback
"Noto Sans CJK TC" # Traditional Chinese fallback
"Noto Sans CJK JP" # Japanese fallback
"Source Han Sans" # Alternative CJK fallback
"JetBrainsMono Nerd Font Mono"
"Noto Sans CJK SC"
"Noto Sans CJK TC"
"Noto Sans CJK JP"
"Source Han Sans"
];
font-family-bold = "JetBrainsMono NFM Bold";
font-family-italic = "JetBrainsMono NFM Italic";
font-family-bold-italic = "JetBrainsMono NFM Bold Italic";
font-size = cfg.fontSize;
# Gruvbox Dark Theme
background = "#14191f";
cursor-style-blink = false;
# Window config
window-theme = "dark";
window-padding-balance = true;
# Shell integration
shell-integration = "detect";
shell-integration-features = "cursor,sudo,title";
# Terminal type - use widely-supported xterm-256color for SSH compatibility
term = "xterm-256color";
# Mouse settings
mouse-hide-while-typing = true;
mouse-shift-capture = false;
# Performance and appearance
adjust-cell-height = "10%";
minimum-contrast = 1.0;
# Copy/paste
copy-on-select = false;
# OSC-52 clipboard integration (works with Neovim and tmux)
clipboard-read = "allow"; # Allow programs to read clipboard without prompting
clipboard-write = "allow"; # Allow programs to write to clipboard without prompting
# Scrollback
clipboard-read = "allow";
clipboard-write = "allow";
scrollback-limit = 10000;
# Bell
desktop-notifications = false;
# Quit behavior
confirm-close-surface = false;
macos-titlebar-style = "hidden";
macos-option-as-alt = "left";
}
# Conditional window settings based on mode
(mkIf (cfg.windowMode == "windowed") {
window-width = cfg.windowWidth;
window-height = cfg.windowHeight;
})
(mkIf (cfg.windowMode == "maximized") {
maximize = true;
})
(mkIf (cfg.windowMode == "fullscreen") {
fullscreen = true;
})

View file

@ -1,29 +1,19 @@
{ config, pkgs, ... }:
{
# Enable git-credential-oauth for GitHub, GitLab, BitBucket
programs.git-credential-oauth = {
enable = true;
};
programs.git = {
enable = true;
ignores = [
# Claude Code
"**/.claude/settings.local.json"
# macOS
".DS_Store"
# Editors
".vscode/"
".idea/"
# Development
"node_modules/"
".env"
".env.local"
".env.*.local"
"node_modules/"
".venv/"
];
settings = {
@ -32,14 +22,10 @@
email = "github@yanlincs.com";
};
# Platform-specific credential configuration
credential = {
# OAuth platforms (handled by git-credential-oauth)
"https://github.com".helper = "oauth";
"https://gitlab.com".helper = "oauth";
"https://bitbucket.org".helper = "oauth";
# Token-based platforms
"https://git.overleaf.com".helper = "store";
"https://git.overleaf.com".username = "git";
};

View file

@ -1,17 +1,15 @@
{ config, pkgs, ... }:
{
# Homebrew configuration for package management
homebrew = {
enable = true;
onActivation = {
autoUpdate = true;
cleanup = "zap"; # Removes unlisted formulae/casks
cleanup = "zap";
upgrade = true;
};
greedyCasks = true;
brews = [
# Command-line tools go here
];
casks = [
# Development
@ -51,11 +49,10 @@
];
};
# nix-homebrew configuration for declarative Homebrew installation
nix-homebrew = {
enable = true;
enableRosetta = true; # Apple Silicon support
enableRosetta = true;
user = "yanlin";
autoMigrate = true; # Migrate existing Homebrew if present
autoMigrate = true;
};
}

View file

@ -4,14 +4,9 @@
programs.nixvim = {
enable = true;
defaultEditor = true;
# scowl provides English word lists for completion on NixOS
extraPackages = [ pkgs.scowl ];
# Global settings
globals.mapleader = " ";
# Vim options
opts = {
number = true;
relativenumber = false;
@ -20,35 +15,32 @@
tabstop = 2;
smartindent = true;
wrap = true;
linebreak = true; # Don't break words when wrapping
breakindent = true; # Preserve indentation when wrapping
linebreak = true;
breakindent = true;
termguicolors = true;
signcolumn = "yes";
autoread = true; # Automatically reload files when changed externally
clipboard = "unnamedplus"; # Use system clipboard by default
autoread = true;
clipboard = "unnamedplus";
};
# Enable filetype detection
viAlias = true;
vimAlias = true;
# Gruvbox colorscheme with hard contrast
colorschemes.gruvbox = {
enable = true;
settings = {
contrast = "hard"; # Makes background much darker (#1d2021 instead of #282828)
contrast = "hard";
background = "dark";
};
};
# Plugins
plugins = {
bufferline = {
enable = true;
settings = {
options = {
separator_style = [ "" "" ]; # Remove gaps between tabs
separator_style = [ "" "" ];
};
};
};
@ -57,15 +49,14 @@
enable = true;
settings = {
indent = {
char = ""; # Thinner vertical line
char = "";
};
scope = {
enabled = false; # Disable scope highlighting
enabled = false;
};
};
};
# Syntax highlighting
treesitter = {
enable = true;
settings = {
@ -76,7 +67,7 @@
indent = {
enable = true;
};
ensure_installed = []; # Managed by Nix
ensure_installed = [];
auto_install = false;
};
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
@ -84,7 +75,6 @@
];
};
# Status line with gruvbox theme and relative paths
lualine = {
enable = true;
settings = {
@ -99,38 +89,13 @@
};
};
# Web dev icons
web-devicons = {
enable = true;
};
# Basic auto-completion
cmp = {
enable = true;
autoEnableSources = true;
settings = {
sources = [
{ name = "buffer"; } # Words from open buffers
{ name = "path"; } # File system paths
{ name = "dictionary"; keyword_length = 2; } # English dictionary words
];
mapping = {
"<C-Space>" = "cmp.mapping.complete()"; # Trigger completion manually
"<C-e>" = "cmp.mapping.close()"; # Close completion menu
"<CR>" = "cmp.mapping.confirm({ select = true })"; # Accept selected completion
"<Tab>" = "cmp.mapping.select_next_item()"; # Navigate down in menu
"<S-Tab>" = "cmp.mapping.select_prev_item()"; # Navigate up in menu
};
};
};
# Telescope - Fuzzy finder
telescope = {
enable = true;
keymaps = {
# Find files using Telescope command-line sugar
"<leader>t" = "find_files";
"<leader>g" = "live_grep";
};
@ -174,7 +139,7 @@
render-markdown = {
enable = true;
settings = {
enabled = false; # Disabled by default
enabled = false;
};
};
@ -214,7 +179,6 @@
border = "rounded";
};
mappings = {
# Keep: navigation & file operations
"." = "set_root";
"<bs>" = "navigate_up";
"<cr>" = "open";
@ -232,7 +196,6 @@
d = "delete";
o = { command = "system_open"; nowait = true; };
f = { command = "show_in_finder"; nowait = true; };
# Disable everything else
"#" = "none";
"/" = "none";
"<" = "none";
@ -292,31 +255,24 @@
};
};
# Extra plugins that don't have dedicated modules
extraPlugins = with pkgs.vimPlugins; [
vim-fugitive
cmp-dictionary
plenary-nvim
];
# Keymaps
keymaps = [
# File explorer (neo-tree)
{
mode = "n";
key = "<leader>e";
action = ":Neotree toggle reveal<CR>";
options = { desc = "Toggle file explorer"; };
}
# Markdown rendering
{
mode = "n";
key = "<leader>m";
action = ":RenderMarkdown toggle<CR>";
options = { desc = "Toggle markdown rendering"; };
}
# Basic keymaps
{
mode = "n";
key = "<leader>w";
@ -335,8 +291,6 @@
action = ":e<CR>";
options = { desc = "Refresh"; };
}
# Buffer/Tab navigation
{
mode = "n";
key = "<S-h>";
@ -364,25 +318,7 @@
];
# Additional Lua configuration for plugins that need custom setup
extraConfigLua = ''
-- Dictionary completion setup
${lib.optionalString pkgs.stdenv.isDarwin ''
require("cmp_dictionary").setup({
paths = { "/usr/share/dict/words" }, -- Standard dictionary path on macOS
exact_length = 2, -- Minimum length before completion
first_case_insensitive = true, -- Case insensitive matching
})
''}
${lib.optionalString (!pkgs.stdenv.isDarwin) ''
require("cmp_dictionary").setup({
paths = { "${pkgs.scowl}/share/dict/wamerican.txt" }, -- Nix-provided dictionary on NixOS
exact_length = 2, -- Minimum length before completion
first_case_insensitive = true, -- Case insensitive matching
})
''}
-- Telescope setup for better file finding
local telescope = require('telescope')
local actions = require('telescope.actions')
@ -397,9 +333,6 @@
}
},
}
-- OSC-52 clipboard integration (matches tmux setup, works with Ghostty)
-- This enables clipboard functionality across SSH, tmux, and multi-platform
-- Only enabled on Linux; macOS uses native clipboard with "unnamedplus"
${lib.optionalString (!pkgs.stdenv.isDarwin) ''
vim.g.clipboard = {
name = 'OSC 52',
@ -414,7 +347,6 @@
}
''}
-- Close all buffers except current (preserving special buffers)
function close_other_buffers()
local current_buf = vim.api.nvim_get_current_buf()
local buffers = vim.api.nvim_list_bufs()
@ -423,7 +355,6 @@
if buf ~= current_buf and vim.api.nvim_buf_is_valid(buf) then
local buftype = vim.api.nvim_buf_get_option(buf, 'buftype')
-- Skip special buffers (terminals, quickfix, etc.)
if buftype == "" then
vim.api.nvim_buf_delete(buf, { force = false })
end
@ -431,7 +362,6 @@
end
end
-- Disable italic for code blocks and strings
vim.api.nvim_set_hl(0, "@markup.raw", { italic = false })
vim.api.nvim_set_hl(0, "@markup.raw.block", { italic = false })
vim.api.nvim_set_hl(0, "@markup.raw.markdown_inline", { italic = false })

View file

@ -1,17 +0,0 @@
{ config, pkgs, ... }:
{
home.file.".config/linearmouse/linearmouse.json".text = builtins.toJSON {
"$schema" = "https://app.linearmouse.org/schema/0.10.0";
schemes = [{
"if" = {
device.category = "mouse";
};
scrolling.reverse.vertical = true;
pointer = {
acceleration = 0;
speed = 0.6;
};
}];
};
}

View file

@ -1,21 +0,0 @@
{ config, pkgs, ... }:
{
# Key remapping using hidutil via launchd agent
# Swaps Caps Lock -> Left Control, Right Control -> Caps Lock
launchd.user.agents.remap-keys = {
serviceConfig = {
ProgramArguments = [
"/usr/bin/hidutil"
"property"
"--set"
''{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x7000000E0},{"HIDKeyboardModifierMappingSrc":0x7000000E4,"HIDKeyboardModifierMappingDst":0x700000039}]}''
];
RunAtLoad = true;
KeepAlive = false;
Label = "org.nixos.remap-keys";
StandardErrorPath = "/tmp/remap-keys.err";
StandardOutPath = "/tmp/remap-keys.out";
};
};
}

View file

@ -1,45 +0,0 @@
{ config, pkgs, lib, ... }:
{
# Install rsync package
home.packages = with pkgs; [ rsync ];
programs.zsh.initContent = ''
function rsync-backup() {
if [[ $# -ne 2 ]]; then
echo "Usage: rsync-backup <source/> <destination/>"
echo "Example: rsync-backup ~/Documents/ /backup/documents/"
return 1
fi
local SOURCE="$1"
local DEST="$2"
if [[ "$SOURCE" != */ ]]; then
SOURCE="$SOURCE/"
fi
echo "=== Rsync Backup ==="
echo "Source: $SOURCE"
echo "Destination: $DEST"
echo "==================="
rsync -avh --progress --delete --partial --partial-dir=.rsync-partial --compress "$SOURCE" "$DEST"
if [[ $? -eq 0 ]]; then
echo "Backup completed successfully!"
else
echo "Backup failed with exit code $?"
return 1
fi
}
'';
programs.zsh.shellAliases = {
rsync-quick = "rsync -avh --progress";
rsync-dry = "rsync -avh --progress --dry-run";
rsync-full = "rsync-backup";
rsync-sync = "rsync -avh --progress";
rsync-mirror = "rsync -avh --progress --delete";
};
}

View file

@ -6,19 +6,15 @@
{ config, pkgs, lib, ... }:
{
# Traefik reverse proxy service
services.traefik = {
enable = true;
# Static configuration
staticConfigOptions = {
# Enable Docker provider for automatic service discovery
providers.docker = {
endpoint = "unix:///var/run/docker.sock";
exposedByDefault = false; # Only expose containers with traefik.enable=true
network = "podman"; # Use podman network
exposedByDefault = false;
network = "podman";
};
# Entry points for HTTP and HTTPS
entrypoints = {
web = {
address = ":80";
@ -34,7 +30,6 @@
};
};
# Certificate resolver using Cloudflare DNS challenge
certificatesResolvers.cloudflare = {
acme = {
email = "cloudflare@yanlincs.com";
@ -50,36 +45,27 @@
};
};
# API and dashboard
api = {
dashboard = true;
debug = false;
};
# Logging
log = {
level = "INFO";
};
accessLog = {};
# Global settings
global = {
checkNewVersion = false;
sendAnonymousUsage = false;
};
};
# Dynamic configuration is now defined in host-specific proxy.nix files
# and will be merged with this base configuration
# Environment variables for Cloudflare
environmentFiles = [ "/etc/traefik-env" ];
};
# Ensure Traefik can access Docker socket
systemd.services.traefik.serviceConfig = {
SupplementaryGroups = [ "podman" ];
# Mount Docker/Podman socket for service discovery
BindPaths = [ "/run/podman/podman.sock:/var/run/docker.sock" ];
};
}