Cross-platform dotfiles managed with Nix, Nix Darwin, and Home Manager. Supports macOS and Linux with host-specific configurations.
- Determinate Nix
This repository uses Nix flakes for reproducible, multi-system configurations:
git clone https://github.com/mpriscella/dotfiles.git ~/.config/dotfiles
cd ~/.config/dotfiles
nix develop
home-manager switch --flake .#work-macbook-pro
# For default/devcontainer setup:
home-manager switch --flake .#default
# For generic MacBook Air:
home-manager switch --flake .#macbook-air
# For Linux user:
home-manager switch --flake .#linux-user# Apply configuration changes
home-manager switch --flake .#<configuration-name>
# Build configuration without applying (test first)
home-manager build --flake .#<configuration-name>
# Update flake inputs (nixpkgs, home-manager, etc.)
nix flake update
# Show available configurations
nix flake show
# Check flake validity
nix flake check
# Enter development shell with tools
nix develop
# Format Nix code
nix fmtAvailable configurations:
work-macbook-pro- Work MacBook Pro (Apple Silicon)default- Default/devcontainer setupmacbook-air- Generic MacBook Airlinux-user- Alternative Linux setup
dr- Apply system configuration changesdrb- Build configuration without applyingdrc- Check configuration validity
hms- Apply user configuration changeshmb- Build user configuration without applyinghm- Home Manager command
This repository uses Nix flakes for reproducible, declarative configuration management across multiple systems and architectures.
The flake configuration supports:
- Multiple systems: x86_64-linux, aarch64-linux, x86_64-darwin, aarch64-darwin
- Multiple hosts: Different configurations for work, personal, and development environments
- Reproducible builds: Locked dependency versions via
flake.lock - Development environment: Built-in dev shell with helpful tools
| Configuration | System | Username | Use Case |
|---|---|---|---|
work-macbook-pro |
aarch64-darwin | michaelpriscella | Work MacBook Pro (Apple Silicon) |
macbook-air |
aarch64-darwin | user | Personal MacBook Air |
default |
x86_64-linux | vscode | Devcontainers, CI/CD |
linux-user |
x86_64-linux | user | General Linux setup |
# Switch to work setup
home-manager switch --flake .#work-macbook-pro
# Switch to personal setup
home-manager switch --flake .#macbook-air
# Switch to development/container setup
home-manager switch --flake .#default# Update all flake inputs (nixpkgs, home-manager, etc.)
nix flake update
# Update specific input
nix flake lock --update-input nixpkgs
# View current lock file info
nix flake metadata# Build without applying (test configuration)
home-manager build --flake .#work-macbook-pro
# Check flake for errors
nix flake check
# Show what would be installed/removed
home-manager switch --flake .#work-macbook-pro --dry-runThe flake includes a development shell with helpful tools:
# Enter development shell
nix develop
# Or with direnv (if .envrc is present)
direnv allow # automatically loads when entering directoryThe development shell includes:
- Home Manager binary
- Git
- Nix Language Server (nil)
- Helpful command examples
Each host configuration is in a separate file:
hosts/work-macbook-pro-flake.nix- Work-specific settingshosts/macbook-air-flake.nix- Personal settingshosts/default-flake.nix- Development/container settings
Common configuration is shared via:
common-flake.nix- Shared packages and settingsmodules/machine-config-flake.nix- Reusable options and helper scripts
If you're currently using the non-flake setup:
# 1. Backup current generation (optional)
home-manager generations
# 2. Switch to flake version
home-manager switch --flake .#work-macbook-pro
# 3. Verify everything works as expectedThe flake configurations are compatible with the legacy ones but provide additional benefits:
- Reproducible builds across machines
- Easy switching between different setups
- Locked dependency versions
- Better development experience
This repository includes GPG commit signing configuration. Follow these steps to set up GPG keys for signing your Git commits.
Ensure you have GPG installed:
# Check if GPG is available
gpg --version
# If using this dotfiles setup, GPG is included in the Nix packages# Start the key generation process
gpg --full-generate-keyFollow the prompts:
- Key type: Select
RSA and RSA(option 1) - Key size: Enter
4096for maximum security - Expiration: Choose based on your security policy:
0= key does not expire (not recommended)2y= expires in 2 years (recommended)1y= expires in 1 year
- Real name: Enter your full name (e.g., "Mike Priscella")
- Email: Enter the email associated with your Git commits
- Comment: Optional, can leave blank
- Passphrase: Choose a strong passphrase (you'll need this for signing)
# List all secret keys with long format key IDs
gpg --list-secret-keys --keyid-format=long
# Or use the provided alias
gpg-listOutput will look like:
sec rsa4096/ABC123DEF456 2025-06-18 [SC] [expires: 2027-06-18]
1234567890ABCDEF1234567890ABCDEF12345678
uid [ultimate] Mike Priscella <mpriscella@gmail.com>
ssb rsa4096/XYZ789UVW012 2025-06-18 [E] [expires: 2027-06-18]
Your GPG Key ID is ABC123DEF456 (the part after rsa4096/).
# Export your public key (replace with your actual key ID)
gpg --armor --export ABC123DEF456
# Or use the provided alias
gpg-export ABC123DEF456Copy the entire output (including -----BEGIN PGP PUBLIC KEY BLOCK----- and -----END PGP PUBLIC KEY BLOCK-----).
- Go to GitHub Settings → SSH and GPG keys
- Click "New GPG key"
- Paste your public key
- Click "Add GPG key"
Update your host-specific configuration file with your GPG key ID:
For work machine (.config/home-manager/hosts/work-macbook-pro-flake.nix):
myConfig = {
configPath = "${config.home.homeDirectory}/.config/home-manager/hosts/work-macbook-pro-flake.nix";
gpgSigningKey = "ABC123DEF456"; # Replace with your work key ID
};For personal machine (.config/home-manager/hosts/macbook-air-flake.nix):
myConfig = {
configPath = "${config.home.homeDirectory}/.config/home-manager/hosts/macbook-air-flake.nix";
gpgSigningKey = "XYZ789UVW012"; # Replace with your personal key ID
};For work machine (.config/home-manager/hosts/work-macbook-pro.nix):
myConfig = {
configPath = "${config.home.homeDirectory}/.config/home-manager/hosts/work-macbook-pro.nix";
gpgSigningKey = "ABC123DEF456"; # Replace with your work key ID
};For personal machine (.config/home-manager/hosts/macbook-air.nix):
myConfig = {
configPath = "${config.home.homeDirectory}/.config/home-manager/hosts/macbook-air.nix";
gpgSigningKey = "XYZ789UVW012"; # Replace with your personal key ID
};# Apply flake configuration
home-manager switch --flake .#work-macbook-pro
# Or for other configurations
home-manager switch --flake .#macbook-air
home-manager switch --flake .#default# Rebuild and apply your Home Manager configuration
home-manager switch
# Or if using a specific host file
home-manager switch --file .config/home-manager/hosts/work-macbook-pro.nix# Test GPG functionality
echo "test" | gpg --clearsign
# Make a test commit
git commit --allow-empty -m "Test GPG signing"
# Verify the commit is signed
git log --show-signature -1You should see output like:
gpg: Signature made Wed Jun 18 10:30:00 2025 PDT
gpg: using RSA key ABC123DEF456
gpg: Good signature from "Mike Priscella <mpriscella@gmail.com>"
This dotfiles setup supports different GPG keys for different machines:
- Work Machine: Use your work email and work GPG key
- Personal Machine: Use your personal email and personal GPG key
- Default/Testing: Can be set to
nullto disable signing
The dotfiles include helpful aliases:
# List all secret keys
gpg-list
# Export a public key
gpg-export KEY_ID
# Restart GPG agent (if having issues)
gpg-restart
# Edit a key (change expiration, add email, etc.)
gpg --edit-key KEY_IDGPG agent not starting:
# Restart the GPG agent
gpg-restart
# Or manually
gpg-connect-agent reloadagent /byePassphrase prompts:
- The configuration caches your passphrase for 12 hours
- You'll only need to enter it once per session
Commits not showing as verified:
- Ensure your email in Git config matches the email in your GPG key
- Check that your public key is added to GitHub
- Verify the key ID is correct in your configuration
Key expiration:
# Extend key expiration
gpg --edit-key KEY_ID
gpg> expire
gpg> save
# Re-export and update on GitHub
gpg-export KEY_ID- Use a strong passphrase for your GPG key
- Set key expiration (1-2 years recommended)
- Backup your keys securely:
# Export private key for backup (store securely!) gpg --export-secret-keys --armor KEY_ID > private-key-backup.asc
- Use different keys for work and personal contexts
- Revoke compromised keys immediately:
gpg --gen-revoke KEY_ID > revocation-cert.asc