Cannot find attribute `programs.firefox'

My config doesnt build anymore and the error is pretty weird none of the lines cited in the trace have been written by me

heres the full error

building the system configuration...
error:
       … while calling the 'head' builtin
         at /nix/store/l75sdw6vydkwaa6cfrf33h2pnzikpxm8-source/lib/attrsets.nix:1574:11:
         1573|         || pred here (elemAt values 1) (head values) then
         1574|           head values
             |           ^
         1575|         else

       … while evaluating the attribute 'value'
         at /nix/store/l75sdw6vydkwaa6cfrf33h2pnzikpxm8-source/lib/modules.nix:816:9:
          815|     in warnDeprecation opt //
          816|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          817|         inherit (res.defsFinal') highestPrio;

       … while evaluating the option `system.build.toplevel':

       … while evaluating definitions from `/nix/store/l75sdw6vydkwaa6cfrf33h2pnzikpxm8-source/nixos/modules/system/activation/top-level.nix':

       … while evaluating the option `assertions':

       … while evaluating definitions from `/nix/store/jn3ciar09jyfh2q713vpkh6dwxmmgbnw-source/nixos/common.nix':

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

       error: evaluation aborted with the following error message: 'cannot find attribute `programs.firefox''

heres my config

1 Like

I don’t get it. There’s no firefox module in your config? maybe --show-trace?

Can reproduce it with

# flake.nix
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-24.11";
    home-manager.url = "github:nix-community/home-manager/release-24.11";
  };
  outputs = inputs: {
    nixosConfigurations.vm = inputs.nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        {
          imports = [
            {
              imports = [ inputs.home-manager.nixosModules.home-manager ];
              home-manager = {
                extraSpecialArgs.config = { };
                users.me = { };
              };
            }
          ];
          system.stateVersion = "24.11";
        }
      ];
    };
  };
}
Inputs:
├───home-manager: github:nix-community/home-manager/9d3d080aec2a35e05a15cedd281c2384767c2cfe?narHash=sha256-Gs076ot1YuAAsYVcyidLKUMIc4ooOaRGO0PqTY7sBzA%3D (2025-02-17 02:04:09)
│   └───nixpkgs: github:NixOS/nixpkgs/52e3095f6d812b91b22fb7ad0bfc1ab416453634?narHash=sha256-F5Em0iv/CxkN5mZ9hRn3vPknpoWdcdCyR0e4WklHwiE%3D (2025-03-08 14:51:38)
└───nixpkgs: github:nixos/nixpkgs/20755fa05115c84be00b04690630cb38f0a203ad?narHash=sha256-ri1e8ZliWS3Jnp9yqpKApHaOo7KBN33W8ECAKA4teAQ%3D (2025-03-07 07:35:13)

I don’t know how to start debugging this, and why more people are not hitting it.

Maybe because they enabled the module?

At least that is what I did. I have a strange phenomena as well (don’t know if related) but I get deprecation warnings even though I’m already using the new option: log: firefox.extenstions.packages log should not be shown if `extensions.packages` · Issue #6488 · nix-community/home-manager · GitHub

Ignore my previous comment, because I didn’t notice a massive issue: do not set config in extraSpecialArgs, you will break the entire module system by doing so.

So, remove this:

And wherever you copied this from, stop copying them :slight_smile:

If you want to access the NixOS config from within an HM module, use the osConfig module arg. (Don’t set it, and don’t add it to extraSpecialArgs either, just read from it.)

1 Like

We should stop them early from doing so and fail loudly, I think

2 Likes