<commit_before>{ lib, pythonPackages, fetchurl, kmod, systemd }:

let version = "0.7.9";

in pythonPackages.buildPythonApplication rec {
  name = "cloud-init-${version}";
  namePrefix = "";

  src = fetchurl {
    url = "https://launchpad.net/cloud-init/trunk/${version}/+download/cloud-init-${version}.tar.gz";
    sha256 = "0wnl76pdcj754pl99wxx76hkir1s61x0bg0lh27sdgdxy45vivbn";
  };

  patches = [ ./add-nixos-support.patch ];
  patchPhase = ''
    patchShebangs ./tools

    substituteInPlace setup.py \
      --replace /usr $out \
      --replace /etc $out/etc \
      --replace /lib/systemd $out/lib/systemd \
      --replace 'self.init_system = ""' 'self.init_system = "systemd"'

    patchPhase
    '';

  propagatedBuildInputs = with pythonPackages; [ cheetah jinja2 prettytable
    oauthlib pyserial configobj pyyaml argparse requests jsonpatch ];

  meta = {
    homepage = http://cloudinit.readthedocs.org;
    description = "Provides configuration and customization of cloud instance";
    maintainers = [ lib.maintainers.madjar lib.maintainers.phile314 ];
    platforms = lib.platforms.all;
  };
}<commit_msg>cloud-init: Use prePatch instead of patchPhase hack.<commit_after>{ lib, pythonPackages, fetchurl, kmod, systemd }:

let version = "0.7.9";

in pythonPackages.buildPythonApplication rec {
  name = "cloud-init-${version}";
  namePrefix = "";

  src = fetchurl {
    url = "https://launchpad.net/cloud-init/trunk/${version}/+download/cloud-init-${version}.tar.gz";
    sha256 = "0wnl76pdcj754pl99wxx76hkir1s61x0bg0lh27sdgdxy45vivbn";
  };

  patches = [ ./add-nixos-support.patch ];
  prePatch = ''
    patchShebangs ./tools

    substituteInPlace setup.py \
      --replace /usr $out \
      --replace /etc $out/etc \
      --replace /lib/systemd $out/lib/systemd \
      --replace 'self.init_system = ""' 'self.init_system = "systemd"'
    '';

  propagatedBuildInputs = with pythonPackages; [ cheetah jinja2 prettytable
    oauthlib pyserial configobj pyyaml argparse requests jsonpatch ];

  meta = {
    homepage = http://cloudinit.readthedocs.org;
    description = "Provides configuration and customization of cloud instance";
    maintainers = [ lib.maintainers.madjar lib.maintainers.phile314 ];
    platforms = lib.platforms.all;
  };
}
{'fraction_non_alphanumeric': 0.13277459197176886, 'fraction_numerical': 0.025584472871636524, 'mean_word_length': 3.3699421965317917, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '668525', 'n_tokens_mistral': 797, 'n_tokens_neox': 756, 'n_words': 147}