summaryrefslogtreecommitdiffstats
path: root/lib/tests/modules/attrList-valueMeta-definitions-file-diagnostic-forwarding.nix
blob: e64d50cb95fbffcbeac0f29d4162cbb41eb263bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{ lib, options, ... }:
let
  inherit (lib) mkOption mkMerge types;
in
{
  imports = [
    {
      _file = "the-defs-file.nix";
      config.flags.my-flag = 3.14;
    }
  ];

  options.flags = mkOption {
    type = types.attrListWith {
      elemType = types.anything;
      asAttrs = true;
      mergeAttrValues = _name: vs: lib.head vs;
    };
  };
  options.argv = mkOption { type = types.listOf types.str; };

  # Feed definitions into argv; the float from the-defs-file.nix should cause
  # a type error mentioning that file
  config.argv = mkMerge options.flags.valueMeta.definitions;
}