{
  config,
  lib,
  pkgs,
  ...
}:
let
  inherit (lib)
    mkIf
    mkEnableOption
    mkOption
    types
    ;

  cfg = config.programs.parallel;
in
{
  meta.maintainers = [ lib.maintainers.xavwe ];

  options.programs.parallel = {
    enable = mkEnableOption "GNU Parallel";

    package = lib.mkPackageOption pkgs "parallel-full" { nullable = true; };

    will-cite = mkOption {
      type = types.bool;
      default = false;
      description = ''
        Accept GNU Parallels citation policy: <https://www.gnu.org/software/parallel/parallel_design.html#citation-notice>
      '';
    };
  };

  config = mkIf cfg.enable {
    home = {
      packages = lib.mkIf (cfg.package != null) [ cfg.package ];
      file.".parallel/will-cite" = mkIf cfg.will-cite {
        text = "generated by home manager (programs.parallel.will-cite)";
      };
    };
  };
}
