Gnome-terminal profile generated from home-manager not found [SOLVED]

I wrote a config for gnome-terminal on home.nix but after rebuilding, I can only find the default one I had from before in the Preferences gui.

For context, I used to run gnome-terminal systemwide by putting in environment.systemPackages in configuration.nix, before realising it’s a home-manger option, so I disabled the systemwide one and enabled the home-manager one. The original default profile is still on the system, and is the one gnome-terminal still uses even after rebuilding home-manager.

Home-manager gnome-terminal config:

  programs.gnome-terminal = {
    enable = true;
    showMenubar = false;

    profile.myConfig = {
      default = true;
      visibleName = "my-config";

      showScrollbar = false;
#      transparencyPercent = 90;
      font = "FiraCode Nerd Font 12";
        
      colors = {
        palette = [
          "#1c2023"
          "#c7ae95"
          "#95c7ae"
          "#aec795"
          "#ae95c7"
          "#c795ae"
          "#95aec7"
          "#c7ccd1"
          "#747c84"
          "#c7ae95"
          "#95c7ae"
          "#aec795"
          "#ae95c7"
          "#c795ae"
          "#95aec7"
          "#f3f4f5"
        ];

        backgroundColor = "#1c2023";
        foregroundColor = "#c7ccd1";
      };
    };
  };

My two profiles are my-config and the default one with a long profile id.

Solution

During the writing of this post, I managed to solve it but I’ll write it here if anyone else has this problem, or I just messed sth up.

When a profile is created on the Preferences gui, it has a long profile id. What the user actually names the profile is called visible-name on the config file (I found it in /org/gnome/terminal/legacy/profiles:/ and dumped it using dconf dump) or programs.gnome.profile.<name>.visibleName in the home-manager config.

The trick was to use the profile id of the profile that existed in the Preferences gui instead of myConfig - in my case, this became programs.gnome-terminal.profile.b1dcc9dd-5262-4d8d-a863-c897e6d979b9. In this sub-module, I put my home-manager config for gnome-terminal and everything works! I suspect if you want to have configs for more profiles in home-manager, you first need to create another profile in Preferences and copy the profile id from there, then use that as the submodule name. As far as I have seen, you can’t actually create profiles straight from home-manager configs alone, but I might be wrong.

It should be possible, but the name has to be a valid UUID from the beginning. You can generate one using nix-shell '<nixpkgs>' -A util-linux --run uuidgen.