This NixOS configuration has been refactored to make it easier to share packages and configuration between hosts while maintaining host-specific customizations.
NixOS/
├── hosts/
│ ├── shared/
│ │ └── common.nix # Shared configuration for all hosts
│ ├── default/ # Desktop configuration
│ │ ├── configuration.nix # Desktop-specific settings
│ │ └── hardware-configuration.nix
│ └── laptop/ # Laptop configuration
│ ├── configuration.nix # Laptop-specific settings
│ └── hardware-configuration.nix
├── modules/
│ ├── packages/ # NEW: Shared package management
│ │ └── default.nix # Categorized package definitions
│ ├── core/ # Core system configuration
│ ├── desktop/ # Desktop environment management
│ ├── networking/ # Network configuration
│ └── home/ # Home-manager integration
└── ...
The new packages module provides categorized package management:
- browsers: Web browsers (Chrome, Firefox, Brave, etc.)
- development: Development tools (Postman, API clients, etc.)
- media: Media and entertainment (Spotify, Discord, VLC, etc.)
- utilities: System utilities (gparted, syncthing, etc.)
- gaming: Gaming-related packages (Steam, GameMode, etc.)
- audioVideo: Audio/video tools (PipeWire, EasyEffects, etc.)
- python: Python with optional GTK support
Contains shared settings for:
- Basic system configuration
- Common hardware settings
- Shared services (Syncthing, SSH, etc.)
- User configuration
- Locale settings
- Desktop environment (GNOME)
UPDATED: Comprehensive dotfiles management with chezmoi using project-local storage:
- Project Integration: Dotfiles stored in
~/NixOS/dotfiles/
within the repository - Pre-imported Configuration: Common dotfiles already imported and ready to use
- Instantaneous Sync: Changes apply immediately without rebuilding NixOS
- Independent Operation: Works separately from NixOS and Home Manager
- Helper Scripts:
dotfiles-init
,dotfiles-edit
,dotfiles-apply
, etc. - Shell Aliases:
dotfiles
,dotfiles-diff
- Git Integration: Dotfiles directory is its own git repository
See DOTFILES_README.md
and CHEZMOI_SETUP.md
for complete setup and usage instructions.
- Gaming packages enabled
- AMD GPU configuration
- Java and Android development tools
- LaTeX documentation tools
- Desktop-specific ports (3000)
- Gaming packages disabled (laptop-friendly)
- Intel graphics configuration
- Minimal package set
- Tailscale enabled for mobile connectivity
To add a new package category, edit modules/packages/default.nix
:
newCategory = {
enable = mkEnableOption "new category packages";
packages = mkOption {
type = types.listOf types.package;
default = with pkgs; [
# your packages here
];
description = "List of new category packages";
};
};
In any host configuration:
modules.packages = {
enable = true;
browsers.enable = true; # Enable browsers
gaming.enable = false; # Disable gaming (good for laptops)
development.enable = true; # Enable development tools
};
modules.packages.extraPackages = with pkgs; [
# Host-specific packages that don't fit in categories
specialTool
hostSpecificApp
];
- DRY Principle: No more duplicated package lists between hosts
- Easy Maintenance: Update packages in one place
- Flexible: Enable/disable entire categories per host
- Scalable: Easy to add new hosts that inherit common configuration
- Clear Separation: Host-specific vs. shared configuration is obvious
When adding a new host:
- Create the host directory:
hosts/newhost/
- Add hardware configuration:
hardware-configuration.nix
- Create minimal
configuration.nix
that imports common.nix - Add only host-specific overrides and packages
Example minimal host configuration:
{
imports = [
./hardware-configuration.nix
../../modules
../shared/common.nix
];
# Override hostname
modules.networking.hostName = "my-new-host";
modules.home.hostName = "newhost";
# Host-specific packages
modules.packages.gaming.enable = true; # or false
modules.packages.extraPackages = with pkgs; [
hostSpecificTool
];
# Host-specific hardware/boot configuration
# ...
}
This structure makes it much easier to maintain multiple NixOS configurations while sharing common functionality.
# Initialize dotfiles
dotfiles-init
# Check status
dotfiles-status # or dotfiles
# Edit dotfiles in VS Code/Cursor
dotfiles-edit
# Apply changes to system
dotfiles-apply
# Add new files to management
dotfiles-add ~/.new-config
# Sync with git
dotfiles-sync
# Test configuration
sudo nixos-rebuild test --flake .
# Switch to new configuration
sudo nixos-rebuild switch --flake .
# Build without switching
sudo nixos-rebuild build --flake .