Nixos-rebuild fails with current configuration

nixos-rebuild test throws an exception but it did not change any of the configuration files on which the current run has been build:

building Nix...
building the system configuration...
error: attribute 'extend' missing

       at /nix/store/bmxyjabn7zj054239gyx3kga44wi8v91-source/modules/lib/stdlib-extended.nix:7:4:

            6| let mkHmLib = import ./.;
            7| in nixpkgsLib.extend (self: super: {
             |    ^
            8|   hm = mkHmLib { lib = self; };
       Did you mean extends?

I would like to modify my configuration but before doing so I test whether the current one still compiles.

Here some information about my machine:

~ nix-info -m

 - system: `"x86_64-linux"`
 - host os: `Linux 6.2.6, NixOS, 22.11 (Raccoon), 22.11.3196.cd34d6ed7ba`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.11.1`
 - channels(root): `"home-manager-22.11.tar.gz, nixos-22.11"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Is this a new bug or rather an error in my settings?

Here my configuration:
https://codeberg.org/klt/configurations/src/branch/main/nixos

Same problem here when trying to nixos-rebuild switch --flake .#host

- system: `"x86_64-linux"`
 - host os: `Linux 6.2.10, NixOS, 22.11 (Raccoon), 22.11.20230412.87edbd7`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.11.1`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

there is a similar bug report in the upstream repository, are you using the same branch of home manager and nixpkgs?

1 Like

Hello @figsoda, I am not sure how to answer your question.
I guess that I follow master for home-manager:

let
  home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/master.tar.gz";
in

but unstable for nixos:

let
  unstableTarball =
    fetchTarball
      https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz;
in

Is this what you mean
Is this setting wrong?

Assuming you’re using 21.11, you’d want to change your home-manager assignment to:

let 
  home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-21.11.tar.gz"; 
in 

I also had this issue, and switch/rebuilds starting failing (likely due to an update). The sample in the wiki (Home Manager - NixOS Wiki) demonstrates pointing to master, which I now know should be your release version.

3 Likes

Thanks @joshrosso for your help.
I changed to
home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-22.11.tar.gz";
and NixOS rebuilds :slight_smile:

1 Like

For those using flakes, here is the syntax to use the proper version of Home Manager:

home-manager.url = "github:nix-community/home-manager/release-22.11";

7 Likes

Fixed it for me! Thanks Taco Milkshake!!!

I owe you a Taco and a milkshake, thanks.

2 Likes