A comprehensive NixOS and Home Manager configuration designed for multi-system deployment with secure secrets management.
nix-config/
βββ config/ # Static configuration files
βββ dotfiles/ # Dotfiles and configs
βββ home/ # Home Manager modules
βββ hosts/ # Host-specific configurations
βββ modules/ # Reusable Nix modules
βββ secrets/ # Encrypted secrets (sops-nix)
βββ system/ # System-wide configurations
βββ users/ # User-specific configurations
βββ scripts/ # Helper scripts
βββ .sops.yaml # Sops configuration
βββ flake.nix # Main flake configuration
- NixOS installed
- Flakes enabled
- Git configured
# Clone the repository
git clone <repository-url>
cd nix-config
# Deploy system configuration
just deploy framework
# Deploy user configuration
just user lars- framework: Framework 13 AMD laptop with GNOME desktop
- beelink: Beelink desktop system
- Framework: Full laptop setup with WiFi secrets, secure boot, hardware optimizations
- Beelink: Desktop configuration with simplified boot setup
The configuration uses Home Manager for user-specific settings:
- Shell: Zsh with Starship prompt
- Editor: Neovim with custom configuration
- Terminal: Ghostty
- Development: VSCode, Go, Node.js, Python
- Applications: Firefox, Thunderbird, Slack, Discord
- Declarative dotfiles management
- Consistent shell environment
- Development tools and language servers
- GUI applications with themes
This configuration uses sops-nix for secure secrets management.
-
Generate age key (already done for framework):
mkdir -p ~/.config/sops/age age-keygen -o ~/.config/sops/age/keys.txt chmod 600 ~/.config/sops/age/keys.txt
-
Add secrets:
# Common secrets (shared across systems) nix-shell -p sops --run "sops secrets/common.yaml" # Framework-specific secrets nix-shell -p sops --run "sops secrets/framework.yaml"
-
Deploy with secrets:
just deploy framework
- Common: User info, email credentials, SSH keys, GitHub tokens
- Framework: WiFi passwords, hardware-specific configs
# Secrets are available at runtime
sudo cat /run/secrets/user_full_name
sudo cat /run/secrets/email_wingu_address
sudo cat /run/secrets/wifi_home_password# Update flake inputs
just update
# Format Nix code
just fmt
# Deploy system
just deploy framework
# Deploy user config
just user lars
# Clean old generations
just clean
# Refresh WiFi connection with secrets
./scripts/refresh-wifi.shscripts/refresh-wifi.sh- Refreshes WiFi connection with updated secretsscripts/setup-secrets.sh- Helps configure secrets for Thunderbird and Git
This configuration uses just as a command runner for common tasks. All commands are defined in the justfile at the root of the repository.
-
Bootstrap secrets:
./scripts/bootstrap-secrets.sh newsystem
-
Follow printed instructions to update
.sops.yaml -
Create host configuration:
mkdir hosts/newsystem # Add configuration.nix and hardware-configuration.nix -
Update flake.nix to include new system
-
Deploy:
just deploy newsystem
The configuration is ready for macOS deployment using nix-darwin:
- Multi-system flake structure
- Platform-specific modules
- Shared home-manager configuration
- Binary caches: Cachix for faster builds
- Parallel builds: Multi-core compilation
- Garbage collection: Automatic cleanup
- Secure Boot: Lanzaboote integration
- Encrypted secrets: sops-nix with age encryption
- Per-system keys: Isolated secret access
- WiFi password management: Secure WiFi credentials via secrets
- Secrets integration: Git, Thunderbird, and system services use encrypted secrets
- Modular design: Easy to customize and extend
- Multi-system support: Framework laptop and Beelink desktop configurations
The configuration uses lib.mkDefault extensively, making it easy to override:
# In user configuration
programs.firefox.enable = false; # Disable Firefox
programs.chromium.enable = true; # Use Chromium instead# In flake.nix homeModules
homeModules = [
./home/applications.nix
./home/my-custom-module.nix # Add your module
# ...
];Secrets not decrypting:
# Check age key exists
ls -la ~/.config/sops/age/keys.txt
# Verify key in .sops.yaml
age-keygen -y ~/.config/sops/age/keys.txt
# Check if secrets are available
sudo ls -la /run/secrets/WiFi not connecting with secret:
# Refresh WiFi connection
./scripts/refresh-wifi.sh
# Or manually refresh
sudo nmcli connection delete "2Fly4MyWifi"
sudo systemctl restart NetworkManagerHome Manager conflicts:
# Remove conflicting packages
nix profile list
nix profile remove <package-name>
# Then rebuild
just user lars- Fork the repository
- Create a feature branch
- Make your changes
- Test on your system
- Submit a pull request
This configuration is provided as-is for educational purposes. Feel free to use and modify for your own systems.