Re: [Nix-dev] nix os modules: how to filter out unset values

2014-07-06 Thread Nicolas Pierron
And I guess you are also interested in a way to filter out these "null" out of the attribute set that you are getting, as the following code does: with (import {}).lib; let filterAttrsRec = pred: v: if isAttrs v then filterAttrs pred (mapAttrs (path: filterAttrsRec pred) v) else

Re: [Nix-dev] nix os modules: how to filter out unset values

2014-07-04 Thread phreedom
On Monday, June 30, 2014 22:56:27 Max Ivanov wrote: > That would work if not type of default should match type of option. So > to make it work, I'd need to invent magic values for every type I use, > and then filter them all out, which doesn't seem to be very elegant > solution. Unless the magic

Re: [Nix-dev] nix os modules: how to filter out unset values

2014-06-30 Thread Max Ivanov
That would work if not type of default should match type of option. So to make it work, I'd need to invent magic values for every type I use, and then filter them all out, which doesn't seem to be very elegant solution. The problem is that access to any attribute in config.services.xyz triggers eva

Re: [Nix-dev] nix os modules: how to filter out unset values

2014-06-30 Thread Mateusz Kowalczyk
On 06/30/2014 09:42 AM, Max Ivanov wrote: > Hi Nixers, > > I am building a nix os module and stumbled upon a problem which I > might need your advice on how to approach it. > > What I can't figure out, is how to filter out unset values even if > they don't have a default value set in mkOption. Th

[Nix-dev] nix os modules: how to filter out unset values

2014-06-30 Thread Max Ivanov
Hi Nixers, I am building a nix os module and stumbled upon a problem which I might need your advice on how to approach it. What I can't figure out, is how to filter out unset values even if they don't have a default value set in mkOption. The idea is that application itself handles missing values