anchor.diff:          type = types.lines;
         };
       };
  +
  +    programs.fish.plugins = mkOption {
  +      type = types.listOf types.package;
  +      default = [];
  +      description = ''
  +        The plugins to add to fish.
  +        Built with <varname>buildFishPlugin</varname>.
  +        Overrides manually installed ones.
  +      '';
  +    };
  +
  +    programs.fish.functions = mkOption {
  +      type = types.attrsOf fileType;
  +      default = {};
  +      description = ''
  +        Functions to add to fish.
  +      '';
  +    };
     };
   
  -  config = mkIf cfg.enable {
  +  config = mkIf cfg.enable (mkMerge [{
       home.packages = [ cfg.package ];
   
       xdg.dataFile."fish/home-manager_generated_completions".source =
  
positive.code:         set -g __fish_interactive_config_sourced 1
        end
      '';
    };
  }
  
negative.code:     mapAttrsToList (k: v: "alias ${k}='${v}'") cfg.shellAliases
    );
  
    fileType = types.submodule (
      { name, config, ... }: {
        options = {
          body = mkOption {
            default = null;
            type = types.nullOr types.lines;
            description = "Body of the function.";
          };
  
          source = mkOption {
            type = types.path;
            description = ''
              Path of the source file. The file name must not start
              with a period.
            '';
          };
        };
  
        config = {
          source = mkIf (config.body != null) (
            mkDefault (pkgs.writeTextFile {
              inherit name;
              text = ''
              function ${name}
                ${config.body}
              end
              '';
              executable = true;
            })
          );
        };
      }
    );
  in
  
  {
  