a
This commit is contained in:
Generated
+29
-8
@@ -1,5 +1,25 @@
|
||||
{
|
||||
"nodes": {
|
||||
"darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1763136804,
|
||||
"narHash": "sha256-6p2ljK42s0S8zS0UU59EsEqupz0GVCaBYRylpUadeBM=",
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "973db96394513fd90270ea5a1211a82a4a0ba47f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@@ -7,32 +27,32 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1714043624,
|
||||
"narHash": "sha256-Xn2r0Jv95TswvPlvamCC46wwNo8ALjRCMBJbGykdhcM=",
|
||||
"lastModified": 1726989464,
|
||||
"narHash": "sha256-Vl+WVTJwutXkimwGprnEtXc/s/s8sMuXzqXaspIGlwM=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "86853e31dc1b62c6eeed11c667e8cdd0285d4411",
|
||||
"rev": "2f23fa308a7c067e52dfcc30a0758f47043ec176",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "release-23.11",
|
||||
"ref": "release-24.05",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1713995372,
|
||||
"narHash": "sha256-fFE3M0vCoiSwCX02z8VF58jXFRj9enYUSTqjyHAjrds=",
|
||||
"lastModified": 1735563628,
|
||||
"narHash": "sha256-OnSAY7XDSx7CtDoqNh8jwVwh4xNL/2HaJxGjryLWzX8=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "dd37924974b9202f8226ed5d74a252a9785aedf8",
|
||||
"rev": "b134951a4c9f3c995fd7be05f3243f8ecd65d798",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-23.11",
|
||||
"ref": "nixos-24.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
@@ -55,6 +75,7 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"darwin": "darwin",
|
||||
"home-manager": "home-manager",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable"
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
# Home-Manager Configuration
|
||||
|
||||
This directory contains a refactored, modular home-manager configuration organized by program/tool.
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
home-manager/
|
||||
├── home.nix # Main entry point with all imports
|
||||
├── common.nix # Base configuration (overlays, minimal packages)
|
||||
│
|
||||
├── platform/ # Platform-specific configurations
|
||||
│ ├── darwin.nix # macOS-specific settings
|
||||
│ └── linux.nix # Linux-specific settings
|
||||
│
|
||||
└── modules/ # Modular configurations by program/tool
|
||||
├── git.nix # Git configuration (unified from old common + development)
|
||||
├── shells.nix # Bash, Zsh, Fish configurations
|
||||
├── cli-tools.nix # Modern CLI tools (ripgrep, fd, bat, etc.)
|
||||
├── terminal-emulators.nix # Terminal emulator configs (Alacritty)
|
||||
├── editors.nix # Text editor configs (Neovim)
|
||||
├── multiplexers.nix # Terminal multiplexers (tmux)
|
||||
└── dev-tools.nix # Development tools (gh, lazygit, direnv)
|
||||
```
|
||||
|
||||
## What Changed?
|
||||
|
||||
### Problems Solved
|
||||
|
||||
1. **Git configuration conflict**: Previously, both `common.nix` and `development.nix` configured `programs.git`, causing conflicts. Now unified in `modules/git.nix`
|
||||
|
||||
2. **Package duplication**: Tools like `ripgrep` and `fd` were listed in multiple files. Now centralized in `modules/cli-tools.nix`
|
||||
|
||||
3. **Unclear module boundaries**: `development.nix` mixed version control, build tools, and editors without clear purpose. Now split into focused modules.
|
||||
|
||||
4. **Mixed concerns**: `terminal.nix` contained terminal emulator + CLI tools + text editor + tmux. Now properly separated.
|
||||
|
||||
### File Mapping
|
||||
|
||||
| Old File | New Location |
|
||||
|----------|--------------|
|
||||
| `development.nix` | → Split into `modules/git.nix` and `modules/dev-tools.nix` |
|
||||
| `shell.nix` | → `modules/shells.nix` |
|
||||
| `terminal.nix` | → Split into `modules/terminal-emulators.nix`, `modules/editors.nix`, `modules/multiplexers.nix`, and `modules/cli-tools.nix` |
|
||||
| `common.nix` | → Simplified (git config moved to `modules/git.nix`, CLI tools to `modules/cli-tools.nix`) |
|
||||
| `darwin.nix` | → `platform/darwin.nix` |
|
||||
| `linux.nix` | → `platform/linux.nix` |
|
||||
|
||||
## Benefits
|
||||
|
||||
- **Clear separation of concerns**: Each module has a single, well-defined purpose
|
||||
- **No more conflicts**: Git is configured in one place
|
||||
- **No duplication**: Packages appear once
|
||||
- **Easy to find things**: Need to configure git? Check `modules/git.nix`
|
||||
- **Easy to disable features**: Comment out imports in `home.nix`
|
||||
- **Platform-specific code isolated**: macOS and Linux configs clearly separated
|
||||
|
||||
## Usage
|
||||
|
||||
To disable a feature, simply comment out its import in `home.nix`:
|
||||
|
||||
```nix
|
||||
imports = [
|
||||
./common.nix
|
||||
./platform/darwin.nix
|
||||
./platform/linux.nix
|
||||
./modules/git.nix
|
||||
./modules/shells.nix
|
||||
# ./modules/multiplexers.nix # Disable tmux
|
||||
# ...
|
||||
];
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. Configure your git identity in `modules/git.nix` (lines 11-13)
|
||||
2. Enable/disable optional packages in each module as needed
|
||||
3. Add new modules following the same pattern (one file per program/tool category)
|
||||
|
||||
@@ -29,31 +29,8 @@
|
||||
# Archives
|
||||
zip
|
||||
unzip
|
||||
|
||||
# Utils
|
||||
ripgrep # Better grep
|
||||
fd # Better find
|
||||
jq # JSON processor
|
||||
yq-go # YAML processor
|
||||
|
||||
# System tools
|
||||
htop
|
||||
tree
|
||||
wget
|
||||
curl
|
||||
];
|
||||
|
||||
# Basic git configuration
|
||||
programs.git = {
|
||||
enable = true;
|
||||
extraConfig = {
|
||||
init.defaultBranch = "main";
|
||||
pull.rebase = true;
|
||||
push.autoSetupRemote = true;
|
||||
};
|
||||
};
|
||||
|
||||
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
|
||||
home.stateVersion = "24.05";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
# Development tools and environment
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
# Version control
|
||||
git
|
||||
gh # GitHub CLI
|
||||
lazygit # Terminal UI for git
|
||||
|
||||
# Languages and runtimes (add what you need)
|
||||
# python311
|
||||
# nodejs_20
|
||||
# go
|
||||
# rustc
|
||||
# cargo
|
||||
|
||||
# Build tools
|
||||
gnumake
|
||||
cmake
|
||||
|
||||
# Text editors / IDEs
|
||||
# neovim
|
||||
# vscode
|
||||
|
||||
# Docker and containers (Linux only, macOS uses Docker Desktop)
|
||||
] ++ lib.optionals pkgs.stdenv.isLinux [
|
||||
# docker
|
||||
# docker-compose
|
||||
];
|
||||
|
||||
# Git configuration for development
|
||||
programs.git = {
|
||||
enable = true;
|
||||
# TODO: Configure your git identity
|
||||
# userName = "Your Name";
|
||||
# userEmail = "your.email@example.com";
|
||||
|
||||
extraConfig = {
|
||||
core.editor = "vim";
|
||||
merge.conflictstyle = "diff3";
|
||||
diff.algorithm = "histogram";
|
||||
};
|
||||
|
||||
# Git aliases
|
||||
aliases = {
|
||||
st = "status";
|
||||
co = "checkout";
|
||||
br = "branch";
|
||||
ci = "commit";
|
||||
unstage = "reset HEAD --";
|
||||
last = "log -1 HEAD";
|
||||
lg = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
|
||||
};
|
||||
};
|
||||
|
||||
# GitHub CLI
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
git_protocol = "ssh";
|
||||
prompt = "enabled";
|
||||
};
|
||||
};
|
||||
|
||||
# Direnv for per-directory environments
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
}
|
||||
|
||||
+11
-7
@@ -12,14 +12,18 @@
|
||||
# Base configuration shared across all platforms
|
||||
./common.nix
|
||||
|
||||
# Feature modules
|
||||
./development.nix
|
||||
./shell.nix
|
||||
./terminal.nix
|
||||
|
||||
# Platform-specific configurations
|
||||
./linux.nix
|
||||
./darwin.nix
|
||||
./platform/darwin.nix
|
||||
./platform/linux.nix
|
||||
|
||||
# Modular configurations by program/tool
|
||||
./modules/git.nix
|
||||
./modules/shells.nix
|
||||
./modules/cli-tools.nix
|
||||
./modules/terminal-emulators.nix
|
||||
./modules/editors.nix
|
||||
./modules/multiplexers.nix
|
||||
./modules/dev-tools.nix
|
||||
|
||||
# If you want to use modules your own flake exports (from modules/home-manager):
|
||||
# inputs.self.homeManagerModules.example
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
# Modern CLI tools and utilities
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
# Modern replacements for standard tools
|
||||
ripgrep # Better grep
|
||||
fd # Better find
|
||||
sd # Better sed
|
||||
du-dust # Better du
|
||||
duf # Better df
|
||||
procs # Better ps
|
||||
bottom # Better top/htop
|
||||
|
||||
# System monitoring
|
||||
htop
|
||||
|
||||
# File utilities
|
||||
tree
|
||||
|
||||
# Network tools
|
||||
wget
|
||||
curl
|
||||
|
||||
# Text processing
|
||||
jq # JSON processor
|
||||
yq-go # YAML processor
|
||||
|
||||
# Optional file managers (commented out by default)
|
||||
# ranger
|
||||
# nnn
|
||||
# lf
|
||||
];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
# Development tools and utilities
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
# Version control tools
|
||||
gh # GitHub CLI
|
||||
lazygit # Terminal UI for git
|
||||
|
||||
# Build tools
|
||||
gnumake
|
||||
cmake
|
||||
|
||||
# Optional language runtimes (uncomment as needed)
|
||||
# python311
|
||||
# nodejs_20
|
||||
# go
|
||||
# rustc
|
||||
# cargo
|
||||
|
||||
# Docker and containers (Linux only, macOS uses Docker Desktop)
|
||||
] ++ lib.optionals pkgs.stdenv.isLinux [
|
||||
# docker
|
||||
# docker-compose
|
||||
];
|
||||
|
||||
# GitHub CLI configuration
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
git_protocol = "ssh";
|
||||
prompt = "enabled";
|
||||
};
|
||||
};
|
||||
|
||||
# Direnv for per-directory environments
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
# Text editor configurations
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
# Neovim configuration
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
|
||||
extraConfig = ''
|
||||
set number
|
||||
set relativenumber
|
||||
set expandtab
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set smartindent
|
||||
set clipboard=unnamedplus
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
# Git configuration - unified from common.nix and development.nix
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
|
||||
# TODO: Configure your git identity
|
||||
# userName = "Your Name";
|
||||
# userEmail = "your.email@example.com";
|
||||
|
||||
extraConfig = {
|
||||
# From common.nix
|
||||
init.defaultBranch = "main";
|
||||
pull.rebase = true;
|
||||
push.autoSetupRemote = true;
|
||||
|
||||
# From development.nix
|
||||
core.editor = "vim";
|
||||
merge.conflictstyle = "diff3";
|
||||
diff.algorithm = "histogram";
|
||||
};
|
||||
|
||||
# Git aliases
|
||||
aliases = {
|
||||
st = "status";
|
||||
co = "checkout";
|
||||
br = "branch";
|
||||
ci = "commit";
|
||||
unstage = "reset HEAD --";
|
||||
last = "log -1 HEAD";
|
||||
lg = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# Terminal multiplexer configurations
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
# Optional multiplexers (tmux enabled by default below)
|
||||
# zellij
|
||||
];
|
||||
|
||||
# Tmux configuration
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
terminal = "tmux-256color";
|
||||
historyLimit = 10000;
|
||||
baseIndex = 1;
|
||||
keyMode = "vi";
|
||||
mouse = true;
|
||||
|
||||
plugins = with pkgs.tmuxPlugins; [
|
||||
sensible
|
||||
yank
|
||||
vim-tmux-navigator
|
||||
];
|
||||
|
||||
extraConfig = ''
|
||||
# Split panes using | and -
|
||||
bind | split-window -h
|
||||
bind - split-window -v
|
||||
unbind '"'
|
||||
unbind %
|
||||
|
||||
# Reload config
|
||||
bind r source-file ~/.config/tmux/tmux.conf
|
||||
|
||||
# Easy pane switching
|
||||
bind -n M-Left select-pane -L
|
||||
bind -n M-Right select-pane -R
|
||||
bind -n M-Up select-pane -U
|
||||
bind -n M-Down select-pane -D
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Shell configuration (bash, zsh, fish, etc.)
|
||||
# Shell configuration (bash, zsh, fish) with integrations
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
@@ -0,0 +1,39 @@
|
||||
# Terminal emulator configurations
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
# Alacritty terminal emulator configuration
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
settings = {
|
||||
window = {
|
||||
padding = {
|
||||
x = 10;
|
||||
y = 10;
|
||||
};
|
||||
decorations = "full";
|
||||
opacity = 0.95;
|
||||
};
|
||||
|
||||
font = {
|
||||
size = 13.0;
|
||||
normal = {
|
||||
family = "JetBrainsMono Nerd Font";
|
||||
style = "Regular";
|
||||
};
|
||||
};
|
||||
|
||||
colors = {
|
||||
primary = {
|
||||
background = "0x1e1e1e";
|
||||
foreground = "0xd4d4d4";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
# Terminal applications and utilities
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
# Modern CLI tools
|
||||
ripgrep # Better grep
|
||||
fd # Better find
|
||||
sd # Better sed
|
||||
du-dust # Better du
|
||||
duf # Better df
|
||||
procs # Better ps
|
||||
bottom # Better top/htop
|
||||
|
||||
# File managers
|
||||
# ranger
|
||||
# nnn
|
||||
# lf
|
||||
|
||||
# Multiplexers
|
||||
# tmux
|
||||
# zellij
|
||||
];
|
||||
|
||||
# Tmux configuration
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
terminal = "tmux-256color";
|
||||
historyLimit = 10000;
|
||||
baseIndex = 1;
|
||||
keyMode = "vi";
|
||||
mouse = true;
|
||||
|
||||
plugins = with pkgs.tmuxPlugins; [
|
||||
sensible
|
||||
yank
|
||||
vim-tmux-navigator
|
||||
];
|
||||
|
||||
extraConfig = ''
|
||||
# Split panes using | and -
|
||||
bind | split-window -h
|
||||
bind - split-window -v
|
||||
unbind '"'
|
||||
unbind %
|
||||
|
||||
# Reload config
|
||||
bind r source-file ~/.config/tmux/tmux.conf
|
||||
|
||||
# Easy pane switching
|
||||
bind -n M-Left select-pane -L
|
||||
bind -n M-Right select-pane -R
|
||||
bind -n M-Up select-pane -U
|
||||
bind -n M-Down select-pane -D
|
||||
'';
|
||||
};
|
||||
|
||||
# Neovim (optional, can be expanded)
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
|
||||
extraConfig = ''
|
||||
set number
|
||||
set relativenumber
|
||||
set expandtab
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set smartindent
|
||||
set clipboard=unnamedplus
|
||||
'';
|
||||
};
|
||||
|
||||
# Alacritty terminal emulator configuration
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
settings = {
|
||||
window = {
|
||||
padding = {
|
||||
x = 10;
|
||||
y = 10;
|
||||
};
|
||||
decorations = "full";
|
||||
opacity = 0.95;
|
||||
};
|
||||
|
||||
font = {
|
||||
size = 13.0;
|
||||
normal = {
|
||||
family = "JetBrainsMono Nerd Font";
|
||||
style = "Regular";
|
||||
};
|
||||
};
|
||||
|
||||
colors = {
|
||||
primary = {
|
||||
background = "0x1e1e1e";
|
||||
foreground = "0xd4d4d4";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user