Error pinning home-manager configuration

I am getting an inscrutable error message when I attempt to pin the home manager configuration following an example I found somewhere. The error message:

error: The option `users' defined in `/home/user/.config/nixpkgs/home.nix' does not exist.
(use '--show-trace' to show detailed location information)

is triggered by this configuration:

{ config, pkgs, ... }:
  home-manager = builtins.fetchGit {
    url = "";
    ref = "release-20.03";
    rev = "4a8d6280544d9b061c0b785d2470ad6eeda47b02";
in {
  imports = [
    (import "${home-manager}/nixos")

  programs.home-manager.enable = true;
  home.stateVersion = "20.03";

There is no `users’ option in home.nix so I am at a loss of what is wrong.

The way you try to pin HM here is only feasible for installing it system wide and as a nixOS module.

You can not use this technique from within home.nix.

For standalone Home-Manager installation you need to pin from the outside, similar to how it’s done in the Home-Manager template by @ryantm


Thanks @NobbZ. I’ll give that a try.