4

My /etc/nixos/configuration.nix starts with { config, lib, modulesPath, pkgs, ... }:, because that's what was in whichever example I copied. A quick search through the NixOS manual, man nixos-generate-config, and man configuration.nix shows only examples with an even simpler { config, pkgs, ... }:.

Removing the , ... and running nixos-rebuild switch doesn't help; it prints the following three times:

error: anonymous function at /etc/nixos/configuration.nix:1:1 called with unexpected argument 'specialArgs', at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:372:8

How do I figure out its arguments?

1

2 Answers 2

3

I came up with a terrible hack:

  1. Remove the , ...
  2. Run nixos-rebuild switch, which prints

    error: anonymous function at /etc/nixos/configuration.nix:1:1 called with unexpected argument 'specialArgs', at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:372:8

  3. Add the argument above (specialArgs) into the signature.
  4. Repeat steps 2 & 3 until done.

This resulted in the following signature:

{ config, lib, modulesPath, pkgs, specialArgs, options }:

Hopefully someone knows a better way to get this information.

2

As of 2024 man configuration.nix. On the man page under the OPTIONS section you can see the parameters passed to the configuration.nix function.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.