Skip to content

Generate nixosConfigurations #203

Open
@poelzi

Description

I try to generate the flake.nixosConfiguration attrset programatically but run into the same error every time.

Roughly speaking I try to do something like:

{ withSystem, inputs, lib, config, ... }:
{
  flake.nixosConfigurations = lib.mkMerge [
  (builtins.map (name:
    {
      "test.${name}" = inputs.nixpkgs.lib.nixosSystem {
        modules = [];
      };
    }
  ) ["foo"])
  ];
}

I tried a view dozens other methods so far, but always get this or some other error:

error: A definition for option `flake.nixosConfigurations' is not of type `lazy attribute set of raw value'. Definition values:
       - In `/nix/store/dz4vjwq2q95q94a25gmccx9na0r5x5jf-source/flake-module2.nix'

Which is odd because according to modules/nixosConfiguration.nix:

options = {
    flake = mkSubmoduleOptions {
      nixosConfigurations = mkOption {
        type = types.lazyAttrsOf types.raw;

it has the correct type.

I try to generate the flake.nixosConfiguration attrset programatically through a generator that looks at another datastructure.

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions