Passing a `nixosSystem` to `nixos-generators`?

Hi all!

I’m trying out nixos-generators, and I want to pass a nixosSystem to the generator.

Is that possible? Right now I’m getting a error:

$ nix build .\#packages.MTX-SRV
error:
       … while evaluating the attribute 'config.system.build."${(image).config.formatAttr}"'

         at /nix/store/5z81la6av4j0ckp0w1949lxiwjyyykks-source/lib/modules.nix:322:9:

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

       … while calling the 'seq' builtin

         at /nix/store/5z81la6av4j0ckp0w1949lxiwjyyykks-source/lib/modules.nix:322:18:

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

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

       error: Could not load a value as a module, because it is of type "configuration", in file /nix/store/5z81la6av4j0ckp0w1949lxiwjyyykks-source/flake.nix. If you do intend to import this configuration, please only import the modules that make up the configuration. You may have to create a `let` binding, file or attribute to give yourself access to the relevant modules.
       While loading a configuration into the module system is a very sensible idea, it can not be done cleanly in practice.

My config is here: GitHub - shymega/nixfigs at experimental/nixos-generators

Thanks!

Seems like it is expecting a module and not a nixosConfiguration. Can’t you give it a module, instead?

Hey! I figured it out in the end. I just used config.formats.

I did make a WIP PR, as well. Thanks!