anchor.diff:      default = null;
     });
   
  +  mkBrewfileLineOption = mkOption {
  +    type = types.nullOr types.str;
  +    visible = false;
  +    internal = true;
  +    readOnly = true;
  +  };
  +
  +  tapOptions = { config, ... }: {
  +    options = {
  +      name = mkOption {
  +        type = types.str;
  +        example = "homebrew/cask-fonts";
  +        description = ''
  +          When <option>clone_target</option> is unspecified, this is the name of a formula
  +          repository to tap from GitHub using HTTPS. For example, <literal>"user/repo"</literal> will
  +          tap https://github.com/user/homebrew-repo.
  +        '';
  +      };
  +      clone_target = mkNullOrStrOption {
  +        description = ''
  +          Use this option to tap a formula repository from anywhere, using any transport protocol
  +          that <command>git</command> handles. When <option>clone_target</option> is specified, taps
  +          can be cloned from places other than GitHub and using protocols other than HTTPS, e.g.,
  +          SSH, git, HTTP, FTP(S), rsync.
  +        '';
  +      };
  +      force_auto_update = mkNullOrBoolOption {
  +        description = ''
  +          Whether to auto-update the tap even if it is not hosted on GitHub. By default, only taps
  +          hosted on GitHub are auto-updated (for performance reasons).
  +        '';
  +      };
  +
  +      brewfileLine = mkBrewfileLineOption;
  +    };
  +
  +    config = {
  +      brewfileLine = ''tap "${config.name}"''
  +        + optionalString (config.clone_target != null) '', "${config.clone_target}"''
  +        + optionalString (config.force_auto_update != null)
  +          ", force_auto_update: ${boolToString config.force_auto_update}";
  +    };
  +  };
  +
     # Sourced from https://docs.brew.sh/Manpage#global-cask-options
     # and valid values for `HOMEBREW_CASK_OPTS`.
     caskArgsOptions = { config, ... }: {
  
positive.code:         description = "Whether to disable linking of helper executables.";
        };
  
        brewfileLine = mkOption {
          type = types.nullOr types.str;
          visible = false;
          internal = true;
          readOnly = true;
        };
      };
  
      config =
        let
          configuredOptions = filterAttrs (_: v: v != null) (removeAttrs config [ "_module" "brewfileLine" ]);
        in
        {
          brewfileLine =
            if configuredOptions == {}
            then null
            else "cask_args " + mkBrewfileLineOptionsListString configuredOptions;
        };
    };
  
negative.code: let
    cfg = config.homebrew;
  
    mkBrewfileSectionString = heading: type: entries: optionalString (entries != []) ''
      # ${heading}
      ${concatMapStringsSep "\n" (v: v.brewfileLine or ''${type} "${v}"'') entries}
  
    '';
  
    mkMasBrewfileSectionString = entries: optionalString (entries != {}) (
      "# Mac App Store apps\n" +
      concatStringsSep "\n" (mapAttrsToList (name: id: ''mas "${name}", id: ${toString id}'') entries) +
      "\n"
    );
  
  
    brewfile = pkgs.writeText "Brewfile" (
      mkBrewfileSectionString "Taps" "tap" cfg.taps +
      mkBrewfileSectionString "Arguments for all casks" "cask_args"
        (optional (cfg.caskArgs.brewfileLine != null) cfg.caskArgs) +
      mkBrewfileSectionString "Brews" "brew" cfg.brews +
      mkBrewfileSectionString "Casks" "cask" cfg.casks +
      mkMasBrewfileSectionString cfg.masApps +
      mkBrewfileSectionString "Docker containers" "whalebrew" cfg.whalebrews +
      optionalString (cfg.extraConfig != "") ("# Extra config\n" + cfg.extraConfig)
    );
  
  