[Nix-dev] evalModules: how to use it?

Bjørn Forsman bjorn.forsman at gmail.com
Wed Jul 6 18:13:45 CEST 2016


On 6 July 2016 at 18:06, Daniel Hlynskyi <abcz2.uprola at gmail.com> wrote:
> Hi. I have a container generator:
>
> mkContainer =
> { config, lib
> , additionalConfig ? {}
> }:
> let
>   containerParams =
>    { autoStart = true;
>    };
> in
> containerParams //
> { config = { config, pkgs, lib, ... }:
>   { imports = [
>       <fleet/services/common.nix>
>       <fleet/services/tomcat.nix>
>       <fleet/services/networking.nix>
>     ];
>
>     networking.firewall.enable = false;
>   } // additionalConfig;
> }
>
> And I have a container
>
> containers.test = mkContainer { inherit config lib;
>   additionalConfig = {
>     networking.firewall.enable = lib.mkForce true;
>   };
> };
>
> But this is wrong - I can't just // two configurations. AFAIU there is
> lib.evalModules function. How can I use to implement custom overrides?
> My mind is already blowned with it's implementation and dozens of different
> ways to use it are tried with no success.

Maybe what you want is lib.mkMerge?

- Bjørn


More information about the nix-dev mailing list