!wfudwzqQUiJYJnqfSY:nixos.org

NixOS Module System

156 Members
31 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
16 May 2025
@ss:someonex.netSomeoneSerge (Ever OOMed by Element)

I never acquainted with types.nix, is there some fundamental reason that either of two freeform submodules couldn't work when left and right have disjoint explicit options?

with import <nixpkgs/lib>;

evalModules {
  modules = [
    {
      options.foo = mkOption {
        type =
          types.either
            (types.submodule {
              freeformType = types.attrsOf types.str;
              options.marker_a = mkOption {
                type = types.str;
              };
            })
            (
              types.submodule {
                freeformType = types.attrsOf types.str;
                options.marker_b = mkOption {
                  type = types.str;
                };
              }
            );
      };
      config.foo = {
        marker_b = "bar";
      };
    }
  ];
}

{ foo = { marker_a = «error: The option `foo.marker_a' was accessed but has no value defined. Try setting 
the option.»; marker_b = "bar"; }; }
19:49:57

Show newer messages


Back to Room ListRoom Version: 10