A reproducible Home Manager configuration using Nix flakes for managing user environments across different systems and use cases.
Run the following command to install Nix and apply the base configuration directly from GitHub:
wget --output-document=/dev/stdout https://nixos.org/nix/install | sh -s -- --daemon --yes \
&& source /etc/profile \
&& nix --extra-experimental-features 'nix-command flakes' run github:Ev-Mu/home-manager/main#homeConfigurations.base.activationPackageFor ongoing development and customization, clone the repository first:
-
Generate an SSH key and add it to GitHub:
ssh-keygen -t rsa -b 4096 -N "" -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub
-
Add the public key to your GitHub account
-
Install Nix and apply the configuration:
wget --output-document=/dev/stdout https://nixos.org/nix/install | sh -s -- --daemon --yes \ && source /etc/profile \ && nix-shell -p home-manager git \ --run "git clone git@github.com:Ev-Mu/home-manager.git ~/.config/home-manager \ && home-manager switch --extra-experimental-features 'nix-command flakes' --flake $HOME/.config/home-manager#base"
.
├── flake.nix # Main flake configuration with inputs and outputs
├── home.nix # Core Home Manager configuration
├── modules/ # Modular configuration files
│ ├── base/ # Base configuration (includes scripts.nix)
│ └── gui/ # GUI-specific configuration
├── templates/ # Nix flake templates for development environments
└── bin/ # Binary files and executables
- flake.nix - Defines flake inputs (nixpkgs, home-manager, nixgl) and outputs (configurations, templates)
- home.nix - Main Home Manager configuration that imports modules and sets up the user environment
- modules/base/scripts.nix - Helper scripts for common operations (nfi, switch)
The flake defines three Home Manager configurations for different use cases:
- User: emusic
- Type: CLI-only configuration
- Purpose: Lightweight setup with Essential CLI tools, no GUI applications
- User: emusic
- Type: GUI-enabled configuration
- Purpose: Full desktop environment with all base packages plus GUI applications
- User: runner
- Type: GUI-enabled configuration
- Purpose: Configuration for testing configuration changes in GitHub Actions
These configurations exist to support different environments and users while maintaining a consistent configuration approach.
This repository includes Nix flake templates for quickly setting up development environments:
- go - Go development environment with necessary tooling
- npm - Node.js development environment with npm/yarn support
- python - Python development environment with pip and common tools
Each template includes a flake.nix file for dependency management and a .envrc file for direnv integration.
To initialize a new project using a template:
# Using nix directly
nix flake init -t "$HOME/.config/home-manager#<template-name>"
# Using the helper script (after applying configuration)
nfi <template-name>The configuration includes helper scripts defined in modules/base/scripts.nix:
Initialize a new project using a flake template from this repository.
Usage:
nfi <template-name>Example:
nfi go # Initialize a Go project
nfi npm # Initialize a Node.js project
nfi python # Initialize a Python projectSwitch Home Manager configurations with automatic backup.
Usage:
switch [config-name]Examples:
switch # Switch to base configuration (default)
switch gui # Switch to gui configuration
switch runner # Switch to runner configurationThis script automatically creates a backup before switching, making it safe to experiment with configuration changes.
For more information about Nix, Home Manager, and flakes, see RESOURCES.md for a curated collection of documentation, guides, and references.