This document provides instructions on how to set up and manage your Nix environment using Home Manager with a specific configuration.
To install Nix in multi-user mode (recommended for most users), run the following command:
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- installThis script will download and install Nix with the necessary configurations.
To build and activate the Home Manager configuration for the user, use the following commands based on your system:
-
Build the configuration:
nix build ~/.config/nixpkgs/#homeConfiguration.zeihanaulia.activationPackage -o ~/.config/nixpkgs/result
-
Activate the configuration:
~/.config/nixpkgs/result/activate switch --flake ~/.config/nixpkgs/#homeConfiguration.zeihanaulia
-
Build the configuration:
nix build ~/.config/nixpkgs/#homeConfiguration.zeihanaulia.activationPackage -o ~/.config/nixpkgs/result
-
Activate the configuration:
~/.config/nixpkgs/result/activate switch --flake ~/.config/nixpkgs/#homeConfiguration.zeihanaulia
-
Build the configuration:
nix build ~/.config/nixpkgs/#homeConfiguration.zeihanaulia.activationPackage -o ~/.config/nixpkgs/result
-
Activate the configuration:
~/.config/nixpkgs/result/activate switch --flake ~/.config/nixpkgs/#homeConfiguration.zeihanaulia
To update the lock file for specific inputs in your flake, use the flake lock command. For example, to update nixpkgs-unstable:
nix flake lock ~/.config/nixpkgs --update-input nixpkgs-unstableThis command updates the input for nixpkgs-unstable within your flake configuration.
For convenience, you can use the predefined shell aliases to manage your Nix configurations:
-
Update a specific flake input:
flakeup nixpkgs-unstable
-
Build the activation package:
nxb
-
Activate the configuration:
nxa
These aliases simplify the process of managing and updating your Nix environment.
- Upgrade Nix
nix upgrade-nix --nix-store-paths-url https://releases.nixos.org/nix/nix-2.23.3/fallback-paths.nix- Nix Search: A search tool to find available Nix packages and channels.