Skip to content

Infinite recursion when trying to use pkgs defined in perSystem #339

@sarunint

Description

@sarunint

Hello,

I've been trying to migrate my flake to using flake-parts, and I'd like to use pkgs that is defined in perSystem as outlined here, but when I try to build the system, I encountered the following error:

error:
       … while calling the 'seq' builtin
         at /nix/store/ih9vmk2a3mrk6vhmibqzji6kjc6parzp-source/lib/modules.nix:403:18:
          402|         options = checked options;
          403|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          404|         _module = checked (config._module);

       … while evaluating a branch condition
         at /nix/store/ih9vmk2a3mrk6vhmibqzji6kjc6parzp-source/lib/modules.nix:306:9:
          305|       checkUnmatched =
          306|         if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [ ] then
             |         ^
          307|           let

       … while evaluating the module argument `pkgs' in "/nix/store/ih9vmk2a3mrk6vhmibqzji6kjc6parzp-source/nixos/modules/services/hardware/bluetooth.nix":

       … noting that argument `pkgs` is not externally provided, so querying `_module.args` instead, requiring `config`

       … while evaluating definitions from `/nix/store/ih9vmk2a3mrk6vhmibqzji6kjc6parzp-source/nixos/modules/misc/nixpkgs/read-only.nix':

       … while evaluating the option `nixpkgs.config':

       … while evaluating definitions from `/nix/store/ih9vmk2a3mrk6vhmibqzji6kjc6parzp-source/nixos/modules/misc/nixpkgs/read-only.nix':

       … while evaluating the option `nixpkgs.pkgs':

       … while evaluating definitions from `/nix/store/ih9vmk2a3mrk6vhmibqzji6kjc6parzp-source/flake.nix':

       … while evaluating the option `nixpkgs.hostPlatform':

       … while evaluating definitions from `/nix/store/ih9vmk2a3mrk6vhmibqzji6kjc6parzp-source/nixos/modules/misc/nixpkgs/read-only.nix':

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

       error: infinite recursion encountered
       at /nix/store/ih9vmk2a3mrk6vhmibqzji6kjc6parzp-source/lib/modules.nix:1160:7:
         1159|     // {
         1160|       value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |       ^
         1161|       inherit (res.defsFinal') highestPrio;
Command 'nix --extra-experimental-features 'nix-command flakes' build --print-out-paths '.#nixosConfigurations."sarunint-workstation-nixos".config.system.build.toplevel'' returned non-zero exit status 1.

My flake is located here (Please use dev branch, since the commit that cause the error is there.)

From what I understand, config.nixpkgs.hostPlatform.system causes the error somehow? I'm not sure about this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions