<commit_before>{ lib
, fetchFromGitHub
, fetchpatch
, buildGoModule
}:

buildGoModule rec {
  pname = "smartctl_exporter";
  version = "unstable-2020-11-14";

  src = fetchFromGitHub {
    owner = "prometheus-community";
    repo = pname;
    rev = "e27581d56ad80340fb076d3ce22cef337ed76679";
    sha256 = "sha256-iWaFDjVLBIAA9zGe0utbuvmEdA3R5lge0iCh3j2JfE8=";
  };

  patches = [
    # Fixes out of range panic (https://github.com/prometheus-community/smartctl_exporter/issues/19)
    (fetchpatch {
      url = "https://github.com/prometheus-community/smartctl_exporter/commit/15575301a8e2fe5802a8c066c6fa9765d50b8cfa.patch";
      sha256 = "sha256-HLUrGXNz3uKpuQBUgQBSw6EGbGl23hQnimTGl64M5bQ=";
    })
    # Fix validation on empty smartctl response (https://github.com/prometheus-community/smartctl_exporter/pull/31)
    (fetchpatch {
      url = "https://github.com/prometheus-community/smartctl_exporter/commit/744b4e5f6a46e029d31d5aa46642e85f429c2cfa.patch";
      sha256 = "sha256-MgLtYR1SpM6XrZQQ3AgQRmNF3OnaBCqXMJRV9BOzKPc=";
    })
    # Fixes missing metrics if outside of query interval (https://github.com/prometheus-community/smartctl_exporter/pull/18)
    ./0001-Return-the-cached-value-if-it-s-not-time-to-scan-aga.patch
  ];

  vendorSha256 = "1xhrzkfm2p20k7prgdfax4408g4qpa4wbxigmcmfz7kjg2zi88ld";

  meta = with lib; {
    description = "Export smartctl statistics for Prometheus";
    homepage = "https://github.com/prometheus-community/smartctl_exporter";
    license = licenses.lgpl3;
    maintainers = with maintainers; [ hexa ];
  };
}<commit_msg>prometheus-smartctl-exporter: build on linux only<commit_after>{ lib
, fetchFromGitHub
, fetchpatch
, buildGoModule
}:

buildGoModule rec {
  pname = "smartctl_exporter";
  version = "unstable-2020-11-14";

  src = fetchFromGitHub {
    owner = "prometheus-community";
    repo = pname;
    rev = "e27581d56ad80340fb076d3ce22cef337ed76679";
    sha256 = "sha256-iWaFDjVLBIAA9zGe0utbuvmEdA3R5lge0iCh3j2JfE8=";
  };

  patches = [
    # Fixes out of range panic (https://github.com/prometheus-community/smartctl_exporter/issues/19)
    (fetchpatch {
      url = "https://github.com/prometheus-community/smartctl_exporter/commit/15575301a8e2fe5802a8c066c6fa9765d50b8cfa.patch";
      sha256 = "sha256-HLUrGXNz3uKpuQBUgQBSw6EGbGl23hQnimTGl64M5bQ=";
    })
    # Fix validation on empty smartctl response (https://github.com/prometheus-community/smartctl_exporter/pull/31)
    (fetchpatch {
      url = "https://github.com/prometheus-community/smartctl_exporter/commit/744b4e5f6a46e029d31d5aa46642e85f429c2cfa.patch";
      sha256 = "sha256-MgLtYR1SpM6XrZQQ3AgQRmNF3OnaBCqXMJRV9BOzKPc=";
    })
    # Fixes missing metrics if outside of query interval (https://github.com/prometheus-community/smartctl_exporter/pull/18)
    ./0001-Return-the-cached-value-if-it-s-not-time-to-scan-aga.patch
  ];

  vendorSha256 = "1xhrzkfm2p20k7prgdfax4408g4qpa4wbxigmcmfz7kjg2zi88ld";

  meta = with lib; {
    description = "Export smartctl statistics for Prometheus";
    homepage = "https://github.com/prometheus-community/smartctl_exporter";
    license = licenses.lgpl3;
    platforms = platforms.linux;
    maintainers = with maintainers; [ hexa ];
  };
}
{'fraction_non_alphanumeric': 0.11273746496418562, 'fraction_numerical': 0.09467455621301775, 'mean_word_length': 4.326699834162521, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 12, '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': '417393', 'n_tokens_mistral': 1451, 'n_tokens_neox': 1248, 'n_words': 154}