Custom lib attributes suddenly missing after nix flake update

It’s as the title says. I have a nixos configuration that seems to be missing lib functions whenever i update the inputs. No matter what i do, it does not seem to work in the latest commit for nixpkgs.

Checks

Normal checks

  1. Clone my repo nixos
  2. nix flake check

Reproducing the issue:

  1. Clone my repo nixos
  2. nix flake update
  3. nix flake check

Output for the steps:

warning: Git tree '/etc/nixos' is dirty
warning: unknown flake output 'images'
error:
       … while checking flake output 'nixosConfigurations'

         at /nix/store/qk7qh607wv6yf3vzhms5c02idkpbx80i-source/flake.nix:226:7:

          225|       # some sensible default configurations.
          226|       nixosConfigurations =
             |       ^
          227|         lib'.mapAttrs

       … while checking the NixOS configuration 'nixosConfigurations.tokyo'

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

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

       error: attribute 'getUser' missing

       at /nix/store/qk7qh607wv6yf3vzhms5c02idkpbx80i-source/hosts/tokyo/default.nix:8:6:

            7|
            8|     (lib.getUser "enmei")
             |      ^
            9|   ];

Clues

It doesn’t seem to be due to a change in any of the files in my configuration. If anything, checking out in a older commit also gives me the same issue, so i have no clue on how to figure it out. Thanks in advance.

Last time I tried overwriting the lib passed into the module system I had my troubles, too. I think you could inject it pretty early on (aka in the lib used by nixosSystem) or just name it libe or something and pass that in.

That worked. Weirdly enough, i remember switching from that way of using lib because i was having the same issues as i was right now.

In case anyone has the same issue, this commit i made addresses it:

https://github.com/enmeei/nixos/commit/9613c2d9a6fe3f390f7a82c081f8d334a0f67733

This was a regression, it will be fixed with flake: allow specifying the lib argument to nixosSystem by r-vdp · Pull Request #273942 · NixOS/nixpkgs · GitHub

1 Like