ryan4yin / nix-config

❄️ My nix config for both desktops(NixOS+macOS) and homelab servers(NixOS).
https://nixos-and-flakes.thiscute.world
MIT License
1.03k stars 61 forks source link

nixos-install error with modules.nix #25

Closed bitFlow66 closed 12 months ago

bitFlow66 commented 12 months ago

Hi, I am new to Nixos and wanted to have quickstart with your awesome config, but I am stuck with an error while using "nixos-install ....".

Not sure if I made mistake or if it is a general error. So I decided to post here after a long search on google.

Used command: nixos-install --root /mnt --flake .#ai --no-root-password --option substituters "https://mirror.sjtu.edu.cn/nix-channels/store"

Error:

building the flake in git+file:///root/nix-config...
warning: Git tree '/root/nix-config' is dirty
error:
       … while calling the 'seq' builtin

         at /mnt/nix/store/gjd1iiwgwv7x29b21ng2dpysbgjp6kxr-source/lib/modules.nix:320:18:

          319|         options = checked options;
          320|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          321|         _module = checked (config._module);

       … while evaluating a branch condition

         at /mnt/nix/store/gjd1iiwgwv7x29b21ng2dpysbgjp6kxr-source/lib/modules.nix:261:9:

          260|       checkUnmatched =
          261|         if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
             |         ^
          262|           let

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

       error: infinite recursion encountered

       at /mnt/nix/store/gjd1iiwgwv7x29b21ng2dpysbgjp6kxr-source/lib/modules.nix:506:28:

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

Thanks for your help in advance.

ryan4yin commented 12 months ago

Fixed by https://github.com/ryan4yin/nix-config/commit/6879049fa445b5a0ff69248426b49efa42b8fcdd

After adding --show-trace option, the error log should be:

# ...

         at /nix/store/gjd1iiwgwv7x29b21ng2dpysbgjp6kxr-sour
lib/modules.nix:504:44:

          503|       context = name: ''while evaluating the 
ule argument `${name}' in "${key}":'';
          504|       extraArgs = builtins.mapAttrs (name: _:
             |                                            ^
          505|         builtins.addErrorContext (context nam

       … while evaluating the module argument `impermanence'
 "/nix/store/5im7msrlkb1ka1syaq4vb90vlpxdbifg-source/imperma
ce.nix":

       error: infinite recursion encountered

       at /nix/store/gjd1iiwgwv7x29b21ng2dpysbgjp6kxr-source
b/modules.nix:506:28:

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

The error indicates nix could not found an argument named impermanence in its args and specialArgs.