Omarchy + Nix Home Manager Integration #987
somerocketeer
started this conversation in
Manual
Replies: 2 comments 4 replies
-
|
Nice tutorial, thanks! |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
Wow, this is really great. I have been using NixOS for quite a while, and I was thinking about switching over to Arch + Nix to try out Omarchy with a similar workflow as my NixOS configuration using home-manager. Would this guide work with a more current version of Omarchy? Such as 3.1.x or even just 3.0.x? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Home Manager Integration
A comprehensive guide for integrating Nix Home Manager with Omarchy on Arch Linux, providing a reproducible development environment while preserving Omarchy's system configurations.
Works on Omarchy v3.1.7
Changelog
2025-09-04: Updated for Omarchy v2.1.x shell behavior
Table of Contents
Prerequisites
Understanding the stack
What is Nix?
Nix is a purely functional package manager that ensures reproducible builds and allows multiple versions of packages to coexist. Key benefits:
What is Home Manager?
Home Manager uses Nix to manage your user environment declaratively. It handles:
What is Omarchy?
Omarchy is your existing shell environment configuration system that manages:
Integration strategy
We'll configure Home Manager to manage packages and configurations while respecting Omarchy's existing management of specific directories and files.
Installation
Step 1: Install Nix package manager
Step 2: Enable Nix Flakes
Flakes provide reproducible, declarative, and composable package management.
Step 3: Create your project structure
Configuration
Step 4: Create Flake configuration
Create
~/.dotfiles/home-manager/flake.nix:Step 5: Create Home configuration
Create
~/.dotfiles/home-manager/home.nix:Shell setup
Understanding PATH management
Step 6A: Example Bash configuration
Add to
home.nixif using Bash:Step 6B: Example Zsh configuration
Add to
home.nixif using Zsh:Alternative: Omarchy PATH integration
Home Manager command setup
The problem
When using Home Manager with flakes, the
home-managercommand is not installed as a package. Instead, it's accessed throughnix run home-manager. This creates a chicken-and-egg problem on new machines where you need Home Manager to set up your environment, but Home Manager itself isn't directly accessible.Solution: Wrapper script
We solve this by creating a wrapper script that makes
home-manageravailableas a direct command.
Create the wrapper
Location:
~/.local/bin/home-managerAvailable commands
After setting up the wrapper, you can use Home Manager commands directly:
home-manager switch --flake ~/.dotfiles/home-manager#main- Applyconfiguration
home-manager generations- List all generationshome-manager rollback- Rollback to previous generationhome-manager --help- See all available commandsBootstrap process on a new machine
Run
home-manager switch --flake ~/.dotfiles/home-manager#mainApplying configuration
Step 7: Initialize and apply
Step 8: Set default shell (if using Zsh)
Verification
Basic checks
Verify Omarchy protection
Troubleshooting
Common issues
1. "home-manager: command not found"
If you haven't set up the wrapper script yet:
2. File conflicts during switch
3. "Git tree is dirty" warning
4. Nix commands not found after installation
5. Starship prompt not showing
starship init bashorstarship init zshmanually to testGetting help
Maintenance
Updating packages
Convenience aliases
Our Home Manager configuration includes these aliases:
hm- Quick switch (equivalent tohome-manager switch --flake ~/.dotfiles/home-manager#main)nix-upgrade- Pull dotfiles and apply Home Manager changes (if configured)hm-update- Update flake inputs (package versions)Rollback
Adding new packages
home.nixand add packages to thehome.packageslisthome-manager switch --flake ~/.dotfiles/home-manager#mainManaging multiple devices
To add a new device configuration:
Edit
flake.nixand add touserConfigs:Switch using:
home-manager switch --flake ~/.dotfiles/home-manager#laptopOptional features
Jujutsu Version Control
If you prefer Jujutsu over Git, add to
home.nix:Configure after installation:
Automated updates
Create an upgrade script at
~/.local/bin/upgrade-nix:Make it executable:
chmod +x ~/.local/bin/upgrade-nixAdd alias to your shell configuration:
Systemd timer for automatic updates
Create
~/.config/systemd/user/nix-upgrade.service:Create
~/.config/systemd/user/nix-upgrade.timer:Enable the timer:
systemctl --user daemon-reload systemctl --user enable --now nix-upgrade.timerBest practices
changes
home-manager buildbeforeswitchto catch errorsSummary
You now have a fully integrated Nix Home Manager setup that:
script
For questions or issues, consult the
Nix manual and
Home Manager manual.
Beta Was this translation helpful? Give feedback.
All reactions