<commit_before>{ stdenv, fetchFromGitHub, makeWrapper, perlPackages, txt2man
, monitoring-plugins
, wmic-bin ? null }:

stdenv.mkDerivation rec {
  pname = "check-wmiplus";
  version = "1.64";

  # We fetch from github.com instead of the proper upstream as nix-build errors
  # out with 406 when trying to fetch the sources
  src = fetchFromGitHub {
    owner = "speartail";
    repo = "checkwmiplus";
    rev = "v${version}";
    sha256 = "1m36rd2wnc5dk4mm9q4ch67w19144dl112p9s6lhc1sh6h25ln6r";
  };

  patches = [
    ./wmiplus_fix_manpage.patch
  ];

  propagatedBuildInputs = with perlPackages; [
    BHooksEndOfScope ClassDataInheritable ClassInspector ClassSingleton
    ConfigIniFiles DateTime DateTimeLocale DateTimeTimeZone DevelStackTrace
    EvalClosure ExceptionClass FileShareDir ModuleImplementation ModuleRuntime
    MROCompat namespaceautoclean namespaceclean NumberFormat PackageStash
    ParamsValidate ParamsValidationCompiler RoleTiny Specio
    SubExporterProgressive SubIdentify TryTiny
  ];

  nativeBuildInputs = [ makeWrapper txt2man ];

  dontConfigure = true;
  dontBuild = true;
  doCheck = false; # no checks

  postPatch = ''
    substituteInPlace check_wmi_plus.pl \
      --replace /usr/bin/wmic                      ${wmic-bin}/bin/wmic \
      --replace /etc/check_wmi_plus                $out/etc/check_wmi_plus \<commit_msg>check-wmiplus: 1.64 -> 1.65<commit_after>{ stdenv, fetchFromGitHub, makeWrapper, perlPackages, txt2man
, monitoring-plugins
, wmic-bin ? null }:

stdenv.mkDerivation rec {
  pname = "check-wmiplus";
  version = "1.65";

  # We fetch from github.com instead of the proper upstream as nix-build errors
  # out with 406 when trying to fetch the sources
  src = fetchFromGitHub {
    owner = "speartail";
    repo = "checkwmiplus";
    rev = "v${version}";
    sha256 = "1as0iyhy4flpm37mb7lvah7rnd6ax88appjm1icwhy7iq03wi8pl";
  };

  patches = [
    ./wmiplus_fix_manpage.patch
  ];

  propagatedBuildInputs = with perlPackages; [
    BHooksEndOfScope ClassDataInheritable ClassInspector ClassSingleton
    ConfigIniFiles DateTime DateTimeLocale DateTimeTimeZone DevelStackTrace
    EvalClosure ExceptionClass FileShareDir ModuleImplementation ModuleRuntime
    MROCompat namespaceautoclean namespaceclean NumberFormat PackageStash
    ParamsValidate ParamsValidationCompiler RoleTiny Specio
    SubExporterProgressive SubIdentify TryTiny
  ];

  nativeBuildInputs = [ makeWrapper txt2man ];

  dontConfigure = true;
  dontBuild = true;
  doCheck = false; # no checks

  postPatch = ''
    substituteInPlace check_wmi_plus.pl \
      --replace /usr/bin/wmic                      ${wmic-bin}/bin/wmic \
      --replace /etc/check_wmi_plus                $out/etc/check_wmi_plus \
{'fraction_non_alphanumeric': 0.07681053401609364, 'fraction_numerical': 0.02487198244330651, 'mean_word_length': 3.635593220338983, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2975042', 'n_tokens_mistral': 916, 'n_tokens_neox': 874, 'n_words': 196}