mkMerge just for attr. sets?

Hi folks,

I can’t find documentation for mkMerge: Nix (builtins) & Nixpkgs (lib) Functions

I’ve seen examples using it for merging attr. sets. Can I use it also for strings?

config = {
  a.b.c =
    mkMerge [
        (mkIf something
        (mkIf somethingelse

Thank you.


Totally depends on the exact type of a.b.c. If it has a mergeable string type (like “lines”) it will peroperly concatenate individual entries as lines, while if it is a non mergeable string type, your individual mkIfs hopefully will only ever eval a single one to true.