How to Update Home Manage in NixOS?
How to Update Home Manage in NixOS?

NixOS + Linux

How to Update Home Manager in NixOS?

Update the Home Manager in NixOS.

--

The Home Manager allows you to define specific user-based configurations using the nix module system developed for NixOS. The nixos community maintains the Home manager.

Updating the home manager is a very easy task, similar to nixos; in a previous article, I described How to upgrade NixOS 23.11 to NixOS 24.05.

Setup

  1. Check Channel list
  2. Remove the old channel
  3. Add new home manager update channel
  4. Update the channel
  5. Update the home manager switch
  6. Flake

Check Channel list

First, check all the available nixos channel lists with the following command.

$ nix-channel --list

The command output look like this.

$ nix-channel --list
home-manager https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz
nixos https://channels.nixos.org/nixos-23.11

Remove the old channel

Remove the old home manager channel with the following command.

$ nix-channel --remove home-manager

The command output look like this.

$ nix-channel --remove home-manager                             
uninstalling 'home-manager-23.11.tar.gz'
building '/nix/store/xsk9wjy0dpp7w7d3r3bkzxzaklqdzq6q-user-environment.drv'...

Add new home manager update channel

Now, you can add your new home manager channel URL; check out the following example.

$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-24.05.tar.gz home-manager

Update the channel

After adding the new home manager channel version, now update the channel with the following command.

$ nix-channel --update

The command output look like this.

➜  ~ nix-channel --update
this derivation will be built:
/nix/store/b4rl282gfdg5fpjqg9xpdixxg3hpym59-home-manager-24.05.tar.gz.drv
building '/nix/store/b4rl282gfdg5fpjqg9xpdixxg3hpym59-home-manager-24.05.tar.gz.drv'...
unpacking channels...

Learn more about channel commands. Read the nix channel command documentation.

Update the home manager switch

Now, you run the home manager switch command to update the home manager in nixos.

home-manager switch

The command output look like this.

$ home-manager switch -f ~/nixos-config/home.nix                                          
these 43 derivations will be built:
/nix/store/080dl4900ld39cls1558hi5l18cwh1si-hm_homeofficialrajdeepsingh.cache.keep.drv
/nix/store/5i5732r637y80b4msp82571gw88sm4b3-zoom_x86_64.pkg.tar.xz.drv
/nix/store/1r0ylsgvn80hkwsdxd1z369969zk0b09-zoom-6.0.10.5325.drv
/nix/store/1svjgq3mjawbg61k4jhci87x9fvpd33g-torbrowser.desktop.drv
/nix/store/3s813sprmb14yvqjmjkjnmiplc9ddfp8-profile.drv
/nix/store/3yl9jw9knkmx0j3cabzjn0xsz4q8kywj-linkbins.js.drv
/nix/store/v7677bfbffijiw6ij19izs6c9dyq501k-notesnook-2.6.1-init.drv
...

Now, your home manager version is updated successfully.

Flake

If you install a home manager using flake. First, change your flake input home manager with an updated version of the home manager channel URL.

Before running the home-manager switch command, you need to run the first nix flake update command. Then, run the home-manager switch command.

To learn more about Nixos and Linux stuff, follow the Linux publication on Medium and other updates. Follow me on Twitter (X) and Medium.

--

--

Rajdeep Singh
The Linux

JavaScript | TypeScript | Reactjs | Nextjs | Rust | Biotechnology | Bioinformatic | Frontend Developer | Author | https://linktr.ee/officialrajdeepsingh