-
-
Notifications
You must be signed in to change notification settings - Fork 15k
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
_module.args.name gets merged on assignment #53458
Comments
#53443 This was my attempt but it seems to break things horribly. |
I'm not saying, that issue will be fixed when you provide reproduction steps of your issue, but that would be a great start. For example, I don't follow where |
@danbst Sure, let me see if I can provide a MWE so people can play with it. The root cause is in the issue description, though, afaict. https://github.com/furrycatherder/mwe-nixpkgs-53458 This configuration:
|
@furrycatherder yeah, nasty bug. I've combined your example into one file:
And result of invocation:
I can't think of what exactly is wrong here. Surely, |
The problem might be located here: https://github.com/NixOS/nixpkgs/blob/master/lib/types.nix#L375 But then the question becomes, should the
Surely |
Hello, I'm a bot and I thank you in the name of the community for opening this issue. To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human. The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it. If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them. Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel. |
Still a problem, here's a repro that works after #82751: with import ./lib;
evalModules {
modules = [({ lib, ... }: {
options.value = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule ({ name, ... }: {
options.nameValue = lib.mkOption {
default = name;
};
}));
};
config.value.x = {
_module.args.name = "y";
};
})];
} |
I marked this as stale due to inactivity. → More info |
Fixes NixOS#53458, as types.raw doesn't allow setting multiple values
@infinisil, replacing |
@roberth See #160489 (comment), |
Fixes NixOS#53458, as types.raw doesn't allow setting multiple values
Fixes NixOS/nixpkgs#53458, as types.raw doesn't allow setting multiple values
Fixes NixOS/nixpkgs#53458, as types.raw doesn't allow setting multiple values
This change is unfortunate. Right now we place utility functions into _module.args.utils, and this happens across several modules (split across several git repositories, even). This change breaks this ability and likely affects more users that haven't started migrating yet. Could we perhaps change to a submodule with freeformType undefined, such that individual options like |
This is asking for trouble. Logic is better represented by either
The latter is easiest to test.
We'll want to set its freeformType to |
@dminuoso I don't think we have a viable solution within the module system. For now I can only recommend to avoid merging in |
The reason we have been using config._module.args.utils is because zhaofengli/colmena#94 has been preventing us from using readOnly functions straight in explicit options.
Okay, wouldn't that work then? As long as #156533 exists, we can inject new options (and pick something other than |
Fixes NixOS/nixpkgs#53458, as types.raw doesn't allow setting multiple values
Fixes NixOS/nixpkgs#53458, as types.raw doesn't allow setting multiple values
Issue description
If I have an option
"foo"
of typeattrsOf (submodule bar)
and I assign an attrset with_module.args.name
"bar"
, the configuration ofsubmodule bar
will see its name as"foobar"
.This is because
_module.args
istypes.unspecified
which follows the default merging rules, but I'm not sure how to fix it (or if it's working as designed).Steps to reproduce
Technical details
"x86_64-linux"
Linux 4.14.91, NixOS, 18.09.1834.9d608a6f592 (Jellyfish)
yes
yes
nix-env (Nix) 2.1.3
"nixos-19.03pre165037.eebd1a92637, nixpkgs-19.03pre165019.c06debd3f9d"
"nixos-18.09.1834.9d608a6f592"
/home/sean/.nix-defexpr/channels/nixpkgs
The text was updated successfully, but these errors were encountered: