Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate nixosConfigurations #203

Open
poelzi opened this issue Dec 30, 2023 · 1 comment
Open

Generate nixosConfigurations #203

poelzi opened this issue Dec 30, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@poelzi
Copy link

poelzi commented Dec 30, 2023

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.

@roberth
Copy link
Member

roberth commented Dec 30, 2023

Could you try without the [ ] around the mkMerge argument?

@roberth roberth added the enhancement New feature or request label Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants