Nixos-rebuild switch failing after flake update (solved: impermanence bug)

I updated flakes and started getting errors in sudo nixos-rebuild switch with no clear pointers to what the issue is. Output below:

error:
… while calling the ‘head’ builtin

     at /nix/store/16a8jg8zn1xd5a1b9jmwmafr007dmzfx-source/lib/attrsets.nix:922:11:

      921|         || pred here (elemAt values 1) (head values) then
      922|           head values
         |           ^
      923|         else

   … while evaluating the attribute 'value'

     at /nix/store/16a8jg8zn1xd5a1b9jmwmafr007dmzfx-source/lib/modules.nix:807:9:

      806|     in warnDeprecation opt //
      807|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
         |         ^
      808|         inherit (res.defsFinal') highestPrio;

   (stack trace truncated; use '--show-trace' to show the full trace)

   error: attribute 'utils' missing

   at /nix/store/16a8jg8zn1xd5a1b9jmwmafr007dmzfx-source/lib/modules.nix:506:28:

      505|         builtins.addErrorContext (context name)
      506|           (args.${name} or config._module.args.${name})
         |                            ^
      507|       ) (lib.functionArgs f);

full show-trace in link here: PrivateBin

The full trace suggests it errors on home-manager side I guess. Nothing on my HM config has changed other than the flake being updated.

Flake info:

Path: /nix/store/xl0xa9pg7lcahir3wg6hskvdk1kxvkpx-source
Revision: 3bdb9b8c744aba080e36292e0364a5e099c8d3ab-dirty
Last modified: 2023-12-06 21:50:11
Inputs:
├───home-manager: github:nix-community/home-manager/d5824a76bc6bb93d1dce9ebbbcb09a9b6abcc224
│ └───nixpkgs follows input ‘nixpkgs-stable’
├───impermanence: github:nix-community/impermanence/8d16ac97980b3641078dd7c11337bfaa77b45789
├───nix-colors: github:misterio77/nix-colors/37227f274b34a3b51649166deb94ce7fec2c6a4c
│ ├───base16-schemes: github:tinted-theming/base16-schemes/d95123ca6377cd849cfdce92c0a24406b0c6a789
│ └───nixpkgs-lib: github:nix-community/nixpkgs.lib/819180647f428a3826bfc917a54449da1e532ce0
├───nixos-hardware: github:NixOS/nixos-hardware/a15b6e525f5737a47b4ce28445c836996fb2ea8c
├───nixpkgs: github:NixOS/nixpkgs/6df37dc6a77654682fe9f071c62b4242b5342e04
├───nixpkgs-stable: github:NixOS/nixpkgs/0b3d618173114c64ab666f557504d6982665d328
└───sops-nix: github:Mic92/sops-nix/e523e89763ff45f0a6cf15bcb1092636b1da9ed3
├───nixpkgs follows input ‘nixpkgs’
└───nixpkgs-stable follows input ‘nixpkgs-stable’

Any good ideas how to debug/fix the issue?

That does not look like stable.

Do you have matching releases between home-manager and whatever your actual system nixpkgs is?

1 Like

I believe nix flake info always shows hash instead of branch. That hash should be latest commit in 23.11 branch.

Found the problem by downgrading each flake one by one. Issue is in latest impermanence commit, also tracked here: Regression after using escapeSystemdPath · Issue #157 · nix-community/impermanence · GitHub

2 Likes