This document walks you through setting up Nix and Home Manager to manage your system configuration. This is catered towards Azure ML compute instances with it's inherent volume configuration challenges. Still WIP
First, check if Nix is already installed on your system:
nix --version
If Nix is not installed, run the official installer:
sh <(curl -L https://nixos.org/nix/install) --daemon
After installation, source the Nix profile to use it in your current session:
. ~/.nix-profile/etc/profile.d/nix.sh
Check if the Home Manager channel is already added:
nix-channel --list | grep home-manager
If it's not listed, add the Home Manager channel:
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
Check if Home Manager is installed:
home-manager --version
If it's not installed, set up the NIX_PATH environment variable and install Home Manager:
export NIX_PATH=$HOME/.nix-defexpr/channels:/nix/var/nix/profiles/per-user/root/channels${NIX_PATH:+:$NIX_PATH}
nix-shell '<home-manager>' -A install
Create the configuration directory if it doesn't exist:
mkdir -p ~/.config/home-manager
Link your home.nix configuration file:
# If you're in the directory with your home.nix file:
ln -sf "$(pwd)/home.nix" ~/.config/home-manager/home.nix
ln -sf "$(pwd)/modules" ~/.config/home-manager/modules
Apply your configuration using Home Manager:
home-manager switch -b backup
The -b backup
flag creates a backup of your previous configuration.
Select previous generation link and run respective activation script
home-manager generations
- If you encounter permission issues during Nix installation, make sure you have sudo access
- If Home Manager fails to install, verify that your Nix channels are properly updated
- For configuration errors, check the syntax in your home.nix file
This project is licensed under the MIT License - see the LICENSE file for details.