How can I update packges when using `home-manager`?

I am using home-manager on Debian 11.

This is my home.nix:

  config,
  pkgs,
  ... 
}: let nixgl = import <nixgl> { };
in {
  # Home Manager needs a bit of information about you and the
  # paths it should manage.
  home.username = "moss";
  home.homeDirectory = "/home/moss";

  # Packages that should be installed to the user profile.
  home.packages = [
    pkgs.tixati
    pkgs.yate
    pkgs.google-chrome
    pkgs.teams
    pkgs.skypeforlinux
    nixgl.auto.nixGLNvidia
    pkgs.yarn    
    pkgs.signal-desktop
    pkgs.postman
    pkgs.nodePackages_latest.firebase-tools
    pkgs.fnm
    pkgs.nodePackages_latest.typescript-language-server
    pkgs.nodePackages_latest.vscode-langservers-extracted
    pkgs.helix
    pkgs.discord
    pkgs.remnote
    pkgs.veracrypt
    pkgs.cloudflare-warp
    pkgs.yt-dlp
    pkgs.nuclear
    pkgs.element-desktop
    # To ensure we have the correct version of nix installed
    config.nix.package
  ];

  # This value determines the Home Manager release that your
  # configuration is compatible with. This helps avoid breakage
  # when a new Home Manager release introduces backwards
  # incompatible changes.
  #
  # You can update Home Manager without changing this value. See
  # the Home Manager release notes for a list of state version
  # changes in each release.
  home.stateVersion = "22.05";

  # Let Home Manager install and manage itself.
  programs.home-manager.enable = true; 
    
  # enable non-free software
  nixpkgs.config.allowUnfree = true;
  
  # enable experimental features
  nix = {
    package = pkgs.nix;
#    settings.experimental-features = [ "nix-command" "flakes" ];
    settings.experimental-features = [ "nix-command" ];
  };
  
  # set some environment variables that will ease usage of software
  # installed with nix on non-NixOS linux
  # (fixing local issues, settings XDG_DATA_DIRS, etc.):
  targets.genericLinux.enable = true;
  
  # kitty terminal
  
  # programs.kitty.enable = true;
  
  # fish shell
  
  programs.fish.enable = true;
  programs.fish.interactiveShellInit = ''fnm env --use-on-cd | source'';
  
  programs.fish.plugins = [
    {
      name = "tide";
      src = pkgs.fetchFromGitHub {
        owner = "IlanCosman";
        repo = "tide";
        rev = "6833806ba2eaa1a2d72a5015f59c284f06c1d2db";
        sha256 = "vi4sYoI366FkIonXDlf/eE2Pyjq7E/kOKBrQS+LtE+M=";
      };
    }  
    {
      name = "nix-env";
      src = pkgs.fetchFromGitHub {
        owner = "lilyball";
        repo = "nix-env";
        rev = "7b65bd228429e852c8fdfa07601159130a818cfa";
        sha256 = "vi4sYoI366FkIonXDlf/eE2Pyjq7E/kOKBrQS+LtE+M=";
      };
    }  
  ];
}

The nix channel list:

$ nix-channel --list
home-manager https://github.com/nix-community/home-manager/archive/release-22.05.tar.gz
nixgl https://github.com/guibou/nixGL/archive/main.tar.gz
nixos https://nixos.org/channels/nixos-unstable

Now when I try to update packages nothing happens:

$ cd ~/.config/nixpkgs

$ nix-channel --update
unpacking channels...

$ home-manager switch
No change so reusing latest profile generation 60

For example take the package yt-dlp.

On the nix packages website it’s version is 2023.3.4

But on my computer it is:

$ yt-dlp --version 
2022.10.04

How to I update yt-dlp to the latest version?

Single or multiuser installation of nix?

Please also check your NIX_PATH, and roots channels.

I’m missing a nixpkgs channel that home manager usually needs to work.

1 Like
  • multiuser installation of nix
  • NIX_PATH is empty
  • How can I add the nixpkgs channel ?

Then please also check what channels are set up for root.

Like you added the others, but name it nixpkgs


Also please tell us which version of nix you use

$ nix --version
nix (Nix) 2.11.0

$ sudo nix-channel --list
sudo: nix-channel: command not found

Sorry but I couldn’t figure out the URL for it. This didn’t work:

nix-channel --add https://nixos.org/channels/nixpkgs

You already have a nixos channel with the correct URL, use that. But name it nixpkgs.

3 Likes

This did the trick.

Thank you so much!

I have the same issue.

home-manager --version
23.11-pre

Packages are not updated after
nix-channel --update && home-manager switch

When you run the following via bash or zsh, what are the outputs?

for chan in nixos nixpkgs; do printf "%s: %s\n" $chan $(nix-instantiate --eval --expr "(import <$chan> {}).lib.version" 2>/dev/null); done

sudo nix-channel --list

nix-channel --list

ls ~/.config/home-manager
nixos: "24.05pre567746.317484b1ead8"
nixpkgs: "24.05pre568310.eabe8d3eface"
sudo: nix-channel: command not found
home-manager https://github.com/nix-community/home-manager/archive/master.tar.gz
nixos https://nixos.org/channels/nixos-unstable
nixpkgs https://nixos.org/channels/nixpkgs-unstable
README.md  flake.lock  flake.nix  home.nix  machines  pkgs.nix  programs

You are using flakes, nix-channel is not relevant.

Please use nix flake update to update your flakes lockfile.

2 Likes

THANK YOU!!!
I have been scratching my head for a while now. I could not find this anywhere.

(for completeness)

cd ~/.config/home-manager && nix flake update && home-manager switch