Is Home Manager with flakes currently broken?

Recently Home Manager has stopped working with my flake. I tried boiling it down to a minimal flake and it still breaks:

$ home-manager build --flake .#ashley
Home Manager not found at /nix/store/v638jyhpyw8xrml0sk62aryr01wwx129-source.
warning: Git tree '/home/ashley/Projects/TestHM' is dirty
warning: creating lock file '/home/ashley/Projects/TestHM/flake.lock'
warning: Git tree '/home/ashley/Projects/TestHM' is dirty
trace: warning: optionsDocBook is deprecated since 23.11 and will be removed in 24.05
trace: warning: optionsDocBook is deprecated since 23.11 and will be removed in 24.05
trace: warning: optionsDocBook is deprecated since 23.11 and will be removed in 24.05
warning: Git tree '/home/ashley/Projects/TestHM' is dirty
error: file 'home-manager/home-manager/build-news.nix' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)

Is anyone else seeing this sort of thing, or am I doing something wrong? In any case I created an issue for it with more details.

It occasionally does this for me, showing the error: file build-news-nix part, but it doesn’t actually fail. It correctly deploys everything, on a second run it then doesn’t even show that error anymore.

i thought making home-manager follow nixpkgs input is a must for it to work properly, smth like

  inputs = {
    nixpkgs.url = "nixpkgs/nixos-23.11";
    home-manager.url = "github:nix-community/home-manager/release-23.11";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";
  };

But i’ve never used home-manager build, for me it’s part of system config flake

Would you mind sharing your flake and flake.lock?

flake.nix:

{
    inputs =
    {
        nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
        home-manager.url = "github:nix-community/home-manager/release-23.11";
        home-manager.inputs.nixpkgs.follows = "nixpkgs";
    };

    outputs = { self, nixpkgs, home-manager }:
    {
        homeConfigurations.ashley = home-manager.lib.homeManagerConfiguration
        {
            pkgs = import nixpkgs { system = "x86_64-linux"; };
            modules =
            [
                {
                    home.stateVersion = "23.11";
                    home.username = "ashley";
                    home.homeDirectory = "/home/ashley";
                }
            ];
        };
    };
}

flake.lock:

{
  "nodes": {
    "home-manager": {
      "inputs": {
        "nixpkgs": [
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1702195709,
        "narHash": "sha256-+zRjWkm5rKqQ57PuLZ3JF3xi3vPMiOJzItb1m/43Cq4=",
        "owner": "nix-community",
        "repo": "home-manager",
        "rev": "6761b8188b860f374b457eddfdb05c82eef9752f",
        "type": "github"
      },
      "original": {
        "owner": "nix-community",
        "ref": "release-23.11",
        "repo": "home-manager",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1702346276,
        "narHash": "sha256-eAQgwIWApFQ40ipeOjVSoK4TEHVd6nbSd9fApiHIw5A=",
        "owner": "nixos",
        "repo": "nixpkgs",
        "rev": "cf28ee258fd5f9a52de6b9865cdb93a1f96d09b7",
        "type": "github"
      },
      "original": {
        "owner": "nixos",
        "ref": "nixos-23.11",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "home-manager": "home-manager",
        "nixpkgs": "nixpkgs"
      }
    }
  },
  "root": "root",
  "version": 7
}

To reproduce:

sudo nix-collect-garbage -d
home-manager build --flake .#ashley

Result:

$ home-manager build --flake .#ashley
Home Manager not found at /nix/store/v638jyhpyw8xrml0sk62aryr01wwx129-source.
warning: Git tree '/home/ashley/Projects/TestHM' is dirty
warning: creating lock file '/home/ashley/Projects/TestHM/flake.lock'
warning: Git tree '/home/ashley/Projects/TestHM' is dirty
trace: warning: optionsDocBook is deprecated since 23.11 and will be removed in 24.05
trace: warning: optionsDocBook is deprecated since 23.11 and will be removed in 24.05
trace: warning: optionsDocBook is deprecated since 23.11 and will be removed in 24.05
warning: Git tree '/home/ashley/Projects/TestHM' is dirty
error: file 'home-manager/home-manager/build-news.nix' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)

I was able to build this no problem in a clean virtual machine

the only problem was that i obviously had no home-manager command, so instead i did nix run home-manager -- build --flake .#ashley, which brought freshest home-manager from git

And that gives me a thought that maybe your currently installed home-manager command is incompatible with newest changes in repo, or, judging from that it could not find something - not all parts of home-manager are properly rooted so they got cleaned by garbage collection, so that home-manager command stopped working? here i have no idea, not much experience there.

can you try running it home-manager directly from repo’s flake as i did instead?

2 Likes

This worked correctly.

$ nix run home-manager -- build --flake .#ashley
warning: Git tree '/home/ashley/Projects/TestHM' is dirty
warning: Git tree '/home/ashley/Projects/TestHM' is dirty

There are 30 unread and relevant news items.
Read them by running the command "home-manager news".

2 Likes