Rearrange the config structure
This commit is contained in:
parent
61db648993
commit
4689a4f69c
10 changed files with 114 additions and 33 deletions
85
README.md
85
README.md
|
|
@ -29,6 +29,10 @@ home-manager switch --flake github:Logan-Lin/nix-config#yanlin
|
|||
```
|
||||
.
|
||||
├── flake.nix # Main flake configuration and package definitions
|
||||
├── hosts/ # Host-specific configurations
|
||||
│ └── darwin/ # macOS hosts
|
||||
│ ├── iMac/ # iMac configuration
|
||||
│ └── MacBook-Air/ # MacBook Air configuration
|
||||
├── modules/ # Home Manager configuration modules
|
||||
│ ├── git.nix # Git configuration with aliases and settings
|
||||
│ ├── lazygit.nix # Lazygit with gruvbox theme and custom keybindings
|
||||
|
|
@ -43,14 +47,24 @@ home-manager switch --flake github:Logan-Lin/nix-config#yanlin
|
|||
│ ├── btop.nix # Modern system monitor
|
||||
│ ├── ghostty.nix # GPU-accelerated terminal emulator
|
||||
│ ├── syncthing.nix # File synchronization service
|
||||
│ └── tailscale.nix # Secure networking and VPN service
|
||||
├── system/ # System-level nix-darwin configurations
|
||||
│ ├── default.nix # System module imports
|
||||
│ └── macos-defaults.nix # macOS system preferences and customizations
|
||||
│ ├── tailscale.nix # Secure networking and VPN service
|
||||
│ └── homebrew.nix # Homebrew and nix-homebrew configuration
|
||||
├── system/ # System-level configurations
|
||||
│ ├── default.nix # System module imports with platform detection
|
||||
│ └── darwin/ # macOS-specific system configurations
|
||||
│ └── defaults.nix # macOS system preferences and customizations
|
||||
├── config/ # Configuration files
|
||||
│ ├── firefox/ # Firefox browser configuration
|
||||
│ │ ├── bookmarks.nix
|
||||
│ │ ├── extensions.nix
|
||||
│ │ └── search.nix
|
||||
│ ├── packages/ # Package configurations
|
||||
│ │ ├── common.nix # Common packages across platforms
|
||||
│ │ └── darwin.nix # macOS-specific packages
|
||||
│ ├── fonts.nix # Font packages and configuration
|
||||
│ ├── p10k.zsh # Powerlevel10k theme configuration
|
||||
│ ├── projects.nix # Project shortcuts configuration
|
||||
│ └── fonts.nix # Font packages and configuration
|
||||
│ ├── projects.json # Project definitions
|
||||
│ └── projects.nix # Project shortcuts configuration
|
||||
└── scripts/ # Utility scripts
|
||||
└── project-launcher.sh # Dynamic project launcher with window configuration
|
||||
```
|
||||
|
|
@ -117,7 +131,12 @@ hm # home-manager shortcut
|
|||
hms # Quick home-manager switch (rebuild)
|
||||
|
||||
# Directory navigation helpers
|
||||
cdf [pattern] # Find file/directory and cd to its location
|
||||
cdf # Interactive file/directory search with real-time preview
|
||||
# Type to search, Enter to cd to selection or parent
|
||||
|
||||
# Application launcher
|
||||
app [file] # Interactive macOS app selector with fzf
|
||||
# Optional: open file with selected app
|
||||
```
|
||||
|
||||
### 🖥️ Session Management: Tmux
|
||||
|
|
@ -176,10 +195,11 @@ cdf [pattern] # Find file/directory and cd to its location
|
|||
|
||||
#### Usage:
|
||||
```bash
|
||||
proj # List all available projects
|
||||
proj nix-config # Launch nix-config project tmux session
|
||||
proj blog # Launch blog project tmux session
|
||||
proj homelab # Launch homelab project tmux session
|
||||
proj # Interactive project selector with fzf
|
||||
# Shows description, windows, and live tmux status
|
||||
# Preview includes running/not running status
|
||||
proj nix-config # Direct launch (non-interactive mode)
|
||||
proj blog # Direct launch (non-interactive mode)
|
||||
```
|
||||
|
||||
#### Window-Based Configuration:
|
||||
|
|
@ -355,6 +375,43 @@ sudo mdutil -a -i on
|
|||
sudo mdutil -E /
|
||||
```
|
||||
|
||||
## 📦 Package Management: Homebrew Integration
|
||||
|
||||
**Configuration**: `modules/homebrew.nix`
|
||||
**Purpose**: Declarative management of GUI applications via Homebrew on macOS
|
||||
|
||||
### Key Features:
|
||||
- **Declarative Management**: GUI applications defined in nix configuration
|
||||
- **Automatic Updates**: Apps update with system rebuilds
|
||||
- **Cleanup on Rebuild**: Removes unlisted applications (zap mode)
|
||||
- **nix-homebrew Integration**: Homebrew itself managed by Nix
|
||||
|
||||
### Managed Applications:
|
||||
- **Firefox**: Web browser
|
||||
- **Ghostty**: GPU-accelerated terminal emulator
|
||||
- **Obsidian**: Note-taking and knowledge management
|
||||
- **Inkscape**: Vector graphics editor
|
||||
- **Snipaste**: Screenshot and annotation tool
|
||||
- **SlidePilot**: Presentation remote control
|
||||
- **Tencent Meeting**: Video conferencing
|
||||
- **Ovito**: Scientific visualization software
|
||||
- **WeChat**: Messaging and communication
|
||||
|
||||
### Management Commands:
|
||||
```bash
|
||||
# All managed through darwin-rebuild
|
||||
sudo darwin-rebuild switch --flake .
|
||||
|
||||
# Manual Homebrew operations (if needed)
|
||||
brew list # List installed formulae and casks
|
||||
brew info <cask> # Get info about a specific application
|
||||
```
|
||||
|
||||
### Integration Details:
|
||||
- Applications install to `/Applications` automatically
|
||||
- Homebrew managed by nix-homebrew for reproducibility
|
||||
- Both Intel and Apple Silicon apps supported via Rosetta
|
||||
|
||||
## 🔐 SSH Configuration
|
||||
|
||||
**Configuration**: `modules/ssh.nix`
|
||||
|
|
@ -404,8 +461,10 @@ nvim $(fd --type f | fzf --preview 'bat --color=always {}')
|
|||
cd proj && nvim . # Jump to project directory and edit
|
||||
zi && fd "*.md" | fzf # Interactive directory select, then find markdown files
|
||||
|
||||
# Find and navigate to directories containing specific files
|
||||
cdf "Universal Sparse" # Search for files/dirs matching pattern and cd there
|
||||
# Interactive directory navigation with real-time search
|
||||
cdf # Type to search files/directories across your home
|
||||
# Shows preview of directories and file contents
|
||||
# Enter to cd to selection or its parent directory
|
||||
```
|
||||
|
||||
#### Built-in zsh keybindings:
|
||||
|
|
|
|||
14
flake.nix
14
flake.nix
|
|
@ -19,9 +19,9 @@
|
|||
|
||||
outputs = inputs@{ self, nix-darwin, nixpkgs, home-manager, nixvim, claude-code, firefox-addons, nix-homebrew }:
|
||||
let
|
||||
configuration = { pkgs, ... }: {
|
||||
# Common system configuration shared across all Darwin systems
|
||||
commonSystemConfig = { pkgs, ... }: {
|
||||
imports = [
|
||||
./system
|
||||
./modules/tailscale.nix
|
||||
];
|
||||
|
||||
|
|
@ -63,8 +63,8 @@
|
|||
./modules/ghostty.nix
|
||||
./modules/syncthing.nix
|
||||
./config/fonts.nix
|
||||
./config/packages-common.nix
|
||||
./config/packages-macos.nix
|
||||
./config/packages/common.nix
|
||||
./config/packages/darwin.nix
|
||||
];
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
|
@ -81,14 +81,16 @@
|
|||
{
|
||||
darwinConfigurations."iMac" = nix-darwin.lib.darwinSystem {
|
||||
modules = [
|
||||
configuration
|
||||
commonSystemConfig
|
||||
./hosts/darwin/iMac
|
||||
nix-homebrew.darwinModules.nix-homebrew
|
||||
];
|
||||
};
|
||||
|
||||
darwinConfigurations."MacBook-Air" = nix-darwin.lib.darwinSystem {
|
||||
modules = [
|
||||
configuration
|
||||
commonSystemConfig
|
||||
./hosts/darwin/MacBook-Air
|
||||
nix-homebrew.darwinModules.nix-homebrew
|
||||
];
|
||||
};
|
||||
|
|
|
|||
12
hosts/darwin/MacBook-Air/default.nix
Normal file
12
hosts/darwin/MacBook-Air/default.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# MacBook Air-specific configuration
|
||||
networking.computerName = "MacBook-Air";
|
||||
networking.hostName = "MacBook-Air";
|
||||
|
||||
# Import common Darwin configuration
|
||||
imports = [
|
||||
../../../system
|
||||
];
|
||||
}
|
||||
12
hosts/darwin/iMac/default.nix
Normal file
12
hosts/darwin/iMac/default.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# iMac-specific configuration
|
||||
networking.computerName = "iMac";
|
||||
networking.hostName = "iMac";
|
||||
|
||||
# Import common Darwin configuration
|
||||
imports = [
|
||||
../../../system
|
||||
];
|
||||
}
|
||||
|
|
@ -29,4 +29,12 @@
|
|||
# Additional repositories if needed
|
||||
];
|
||||
};
|
||||
|
||||
# nix-homebrew configuration for declarative Homebrew installation
|
||||
nix-homebrew = {
|
||||
enable = true;
|
||||
enableRosetta = true; # Apple Silicon support
|
||||
user = "yanlin";
|
||||
autoMigrate = true; # Migrate existing Homebrew if present
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# nix-homebrew configuration for declarative Homebrew installation
|
||||
nix-homebrew = {
|
||||
enable = true;
|
||||
enableRosetta = true; # Apple Silicon support
|
||||
user = "yanlin";
|
||||
autoMigrate = true; # Migrate existing Homebrew if present
|
||||
};
|
||||
}
|
||||
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
{
|
||||
imports = [
|
||||
../modules/homebrew.nix
|
||||
../modules/nix-homebrew.nix
|
||||
../../modules/homebrew.nix
|
||||
];
|
||||
|
||||
# Set primary user for system preferences
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
{
|
||||
imports = [
|
||||
./macos-defaults.nix
|
||||
./darwin/defaults.nix
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue