Merged list contains duplicates

I have a simple module which I share between my home-manager configurations and nixos configurations:

{ config, pkgs, ... }:
{
  config = {
    nix = {
      settings = {
        substituters = [
          "https://nix-community.cachix.org"
          "https://cache.nixos.org/"
        ];

        trusted-public-keys = [
          "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
          "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
        ];
      };
    };

    environment.systemPackages = with pkgs; [
      cachix
    ];
  };
}

Problem is, that while this module generates correct nix.conf on HM, on nixos it duplicates https://cache.nixos.org/ because nixos already has it in nix.settings.substituters.

I understand that I can introduce a boolean option enable inclusion of cache.nixos.org but I would rather keep module api simple and universal.

Is there is a way to make list merged without dulicates?