What does "nixos profile: nixpkgs are disabled when `home-manager.useGlobalFlags` is enabled" mean?

I am trying to activate home-manager by closely following Getting Started with Home Manager | NixOS & Flakes Book, with the following excerpt:

 outputs = inputs@{ nixpkgs, home-manager, ... }: {
    nixosConfigurations = {
      nixos-test = nixpkgs.lib.nixosSystem {
        system = "x86_64-linux";
        modules = [
          ./configuration.nix
          home-manager.nixosModules.home-manager
          {
            home-manager.useGlobalPkgs = true;
            home-manager.useUserPackages = true;
            home-manager.users.ryan = import ./home.nix;
          }
        ];
      };
    };
  };

but when I rebuild NixOS I get the meaningless errors:

       - nixos profile: `nixpkgs` options are disabled when `home-manager.useGlobalPkgs` is enabled.

What does that mean? Do I have some local settings applied which do not work with flakes?

So, assuming the error you have some nixpkgs.* settings defined in your home.nix. That is not allowed in combination with useGlobalPkgs, as home manager gets the “global” nixpkgs handed over that is used by the nixos system, and that is already configured and initialized by that (I hope that make sense).
Could you check if you are setting such an option in the home manager context?

1 Like