On 09/07/2016 11:54 AM, 4levels wrote:
Hi Rickard,

All I can think of currently is that you could create a new config
variable using filterAttrs to keep only the information you need.
Not sure if this solves your question though as I'm not aware if you can
use another variable in your scenario.

Using filterAttrs like this would introduce an infinite recursion, I think:

config = {
  myattrs = filterAttrs (k: _: k != "a") config.myattrs;
}

But maybe that wasn't what you had in mind.

For the issue that spurred this question I have now added an "enable" option for the attributes, see: https://github.com/NixOS/nixpkgs/pull/18391

However, that is not a general solution to this problem, so any further hints are welcome.

  / Rickard


Kind regards,

Erik

On Wed, Sep 7, 2016 at 12:35 AM Rickard Nilsson
<[email protected] <mailto:[email protected]>> wrote:

    Is it possible to unset an attrsOf option? Say I import a module that
    looks like this:

    options = {
       myattrs = mkOption {
         type = types.attrsOf ...
         default = {};
       };
    }

    config = {
       myattrs = {
         a = ...
         b = ...
       };
    };

    And then I want to remove the "a" attribute in the importing config:

    config = {
       myattrs.a = mkForce ...
    }

    Is that possible in any way?


       / Rickard
    _______________________________________________
    nix-dev mailing list
    [email protected] <mailto:[email protected]>
    http://lists.science.uu.nl/mailman/listinfo/nix-dev


_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to