I’m currently building a module for an in-house project that will be deployed on NixOS.
I’m having trouble to figure out how I can modify the same “etc” from multiple nix files (I just want them to append sections in the generated text file).
In my default.nix
file I import a moduleA.nix
(the time being, more module will be added).
In default.nix
I set the content of the configuration file this way:
config = mkIf cfg.enable {
environment.etc."test.conf" = ''
# My content
'';
};
In moduleA.nix
if I do this:
config = mkIf cfg.moduleA.enable {
environment.etc."test.conf" = ''
# My ModuleA content
'';
};
I get the following error:
error: value is a string while a set was expected, at /home/ely/Code/OpenSource/nixpkgs/lib/modules.nix:304:62
I guess I’m not doing it right ?
What would be the right approach for doing this ?
I thought I could maybe create a list of strings then use builtins.concatStringsSep
but I have the feeling that would be very hacky to do it this way (and I’m not sure how I could implement it).
Thanks