Skip to content

Instantly share code, notes, and snippets.

@drupol
Last active May 1, 2025 18:00
Show Gist options
  • Save drupol/15146d0b2d4eff11473a5db0caf23155 to your computer and use it in GitHub Desktop.
Save drupol/15146d0b2d4eff11473a5db0caf23155 to your computer and use it in GitHub Desktop.

I'm looking for a function that turns this:

{
  module1 = {
    users.users = {
      pol = {
        attr1 = "attr1";
        list = [ "a" "b" ];
      };

      baz = {
        attr2 = "attr2";
        list = [ "c" "d" ];
      };
    };
  };

  module2 = {
    users.users = {
      pol = {
        attr2 = "attr2";
        list = [ "c" "d" ];
      };
    };
  };

  module3 = {
    users.users = {
      baz = {
        attr1 = "attr1";
        list = [ "a" "b" ];
      };
    };
  };
}

Into this:

{
  home-manager.users = {
    pol = {
      attr1 = "attr1";
      attr2 = "attr2";
      list = [ "a" "b" "c" "d" ];
    };
    baz = {
      attr1 = "attr1";
      attr2 = "attr2";
      list = [ "a" "b" "c" "d" ];
    };
  };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment