> Now for one the syntax is incorrect try this: cfg.enable ({ ... } // (if cfg.aggressive then { .. } else { .. } ))
> will be overriden with the value from the second attribute set. there are merge functions defined in lib - but they are overkill. The solution is to move and duplicate the mkIf or use two different modules. I suggested to pierron adding a mkMerge function for exactly that reason - and because mkElse can be used in uncommen ways. I also rewrote the config system making this easy - but I have done no testing yet. Try this: config.powerManagement = { cpuFreqGovernor = "ondemand"; scsiLinkPolicy = if (cfg.aggressive) then "min_power" else mkNoDef; // or something similar, grep nixos code for its usages. } if mkNoDef doesn't work try the // trick shown above. >> [.. infinite recursion ] The problem is that cfg.aggressive can't be evaluated without evaluating the top level config attrs. But that contains the condition! Let me make it obvious: config = mkIf cfg.enable ({ aggressive = true; } // (if cfg.aggressive then { } else { })); in order to evaluate aggressive the module system has to evaluate the if branch.. but in order to know whether it should be evaluated it has to evaluate the condition .. in order to ... :-) You get the point. HTH Marc Weber _______________________________________________ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev