Re: [Nix-dev] joining attribute sets recursively

2012-01-18 Thread Florian Friesdorf
On Mon, 16 Jan 2012 22:05:26 +0100, Nicolas Pierron nicolas.b.pier...@gmail.com wrote: (..) mkX [ {  a = 1;  b = 1;  c.a = 1; } {  b = 2;  c.b = 2;  d = 2; } ] possible results: - error because of colliding b - first value taken: { a = 1; b = 1; c = { a = 1; b = 2 }; d

[Nix-dev] joining attribute sets recursively

2012-01-16 Thread Florian Friesdorf
Hi, I'd like to extend power-management.nix with an aggressive setting: aggressive = mkOption { default = false; description = '' Whether to enable aggressive power management features. An area for experimentation. Please send feedback

Re: [Nix-dev] joining attribute sets recursively

2012-01-16 Thread Marc Weber
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

Re: [Nix-dev] joining attribute sets recursively

2012-01-16 Thread Eelco Dolstra
On 16/01/12 15:37, Florian Friesdorf wrote: config = mkIf cfg.enable { ... powerManagement.cpuFreqGovernor = ondemand; } // cfg.aggressive ? { ... powerManagement.scsiLinkPolicy = min_power; } : {}; Indeed it would be good to have a way of writing this down in a nice way. (Using

Re: [Nix-dev] joining attribute sets recursively

2012-01-16 Thread Marc Weber
Excerpts from Eelco Dolstra's message of Mon Jan 16 16:50:10 +0100 2012: config = mkUnion That mkUnion is exactly what mkMerge should be doing. Wait another week or two. I hope I have nixos running on my rewrite so that we can benchmark both memory consumption and speed. If there are no

Re: [Nix-dev] joining attribute sets recursively

2012-01-16 Thread Florian Friesdorf
On Mon, 16 Jan 2012 16:42:50 +0100, Marc Weber marco-owe...@gmx.de wrote: Now for one the syntax is incorrect try this: cfg.enable ({ ... } // (if cfg.aggressive then { .. } else { .. } )) I fail to see the difference to what I tried, which resulted in infinte recursion, which you

Re: [Nix-dev] joining attribute sets recursively

2012-01-16 Thread Florian Friesdorf
On Mon, 16 Jan 2012 16:50:10 +0100, Eelco Dolstra e.dols...@tudelft.nl wrote: On 16/01/12 15:37, Florian Friesdorf wrote: config = mkIf cfg.enable { ... powerManagement.cpuFreqGovernor = ondemand; } // cfg.aggressive ? { ... powerManagement.scsiLinkPolicy = min_power; } :

Re: [Nix-dev] joining attribute sets recursively

2012-01-16 Thread Nicolas Pierron
On Mon, Jan 16, 2012 at 18:28, Florian Friesdorf f...@chaoflow.net wrote: On Mon, 16 Jan 2012 16:50:10 +0100, Eelco Dolstra e.dols...@tudelft.nl wrote: On 16/01/12 15:37, Florian Friesdorf wrote: config = mkIf cfg.enable {   ...   powerManagement.cpuFreqGovernor = ondemand; } //