<commit_before>{ stdenv
, fetchurl
}:

let
  tarballUrls = version: [
    "mirror://kernel/linux/utils/raid/mdadm/mdadm-${version}.tar"
  ];

  version = "4.1";
in
stdenv.mkDerivation rec {
  name = "mdadm-${version}";

  src = fetchurl {
    urls = map (n: "${n}.xz") (tarballUrls version);
    hashOutput = false;
    sha256 = "ab7688842908d3583a704d491956f31324c3a5fc9f6a04653cb75d19f1934f4a";
  };

  patches = [
    ./no-self-references.patch
  ];

  postPatch = ''
    sed -e 's@/lib/udev@''${out}/lib/udev@' -e 's@ -Werror @ @' -i Makefile
  '';

  preBuild = ''
    makeFlagsArray+=(
      "INSTALL_BINDIR=$out/bin"
      "MANDIR=$out/share/man"
    )
  '';

  makeFlags = [
    "NIXOS=1"
    "RUN_DIR=/dev/.mdadm"
    "INSTALL=install"
  ];

  # This is to avoid self-references, which causes the initrd to explode
  # in size and in turn prevents mdraid systems from booting.
  allowedReferences = [
    stdenv.cc.libc
  ];

  passthru = {
    srcVerification = fetchurl {
      failEarly = true;
      inherit (src)
        urls
        outputHash
        outputHashAlgo;
      fullOpts = {
        pgpDecompress = true;
        pgpsigUrls = map (n: "${n}.sign") (tarballUrls version);
        pgpKeyFingerprint = "6A86 B80E 1D22 F21D 0B26  BA75 397D 82E0 531A 9C91";
      };
    };
  };<commit_msg>mdadm: Fix allowedReferences<commit_after>{ stdenv
, fetchurl
}:

let
  tarballUrls = version: [
    "mirror://kernel/linux/utils/raid/mdadm/mdadm-${version}.tar"
  ];

  version = "4.1";
in
stdenv.mkDerivation rec {
  name = "mdadm-${version}";

  src = fetchurl {
    urls = map (n: "${n}.xz") (tarballUrls version);
    hashOutput = false;
    sha256 = "ab7688842908d3583a704d491956f31324c3a5fc9f6a04653cb75d19f1934f4a";
  };

  patches = [
    ./no-self-references.patch
  ];

  postPatch = ''
    sed -e 's@/lib/udev@''${out}/lib/udev@' -e 's@ -Werror @ @' -i Makefile
  '';

  preBuild = ''
    makeFlagsArray+=(
      "INSTALL_BINDIR=$out/bin"
      "MANDIR=$out/share/man"
    )
  '';

  makeFlags = [
    "NIXOS=1"
    "RUN_DIR=/dev/.mdadm"
    "INSTALL=install"
  ];

  # This is to avoid self-references, which causes the initrd to explode
  # in size and in turn prevents mdraid systems from booting.
  allowedReferences = stdenv.cc.runtimeLibcLibs;

  passthru = {
    srcVerification = fetchurl {
      failEarly = true;
      inherit (src)
        urls
        outputHash
        outputHashAlgo;
      fullOpts = {
        pgpDecompress = true;
        pgpsigUrls = map (n: "${n}.sign") (tarballUrls version);
        pgpKeyFingerprint = "6A86 B80E 1D22 F21D 0B26  BA75 397D 82E0 531A 9C91";
      };
    };
  };
{'fraction_non_alphanumeric': 0.14139499620924942, 'fraction_numerical': 0.05989385898407885, 'mean_word_length': 2.5807327001356852, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5304276', 'n_tokens_mistral': 1144, 'n_tokens_neox': 1028, 'n_words': 198}