Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, pythonPackages, fetchurl, cloud-utils }:
2
3let version = "0.7.9";
4
5in pythonPackages.buildPythonApplication {
6 pname = "cloud-init";
7 inherit version;
8 namePrefix = "";
9
10 src = fetchurl {
11 url = "https://launchpad.net/cloud-init/trunk/${version}/+download/cloud-init-${version}.tar.gz";
12 sha256 = "0wnl76pdcj754pl99wxx76hkir1s61x0bg0lh27sdgdxy45vivbn";
13 };
14
15 patches = [ ./add-nixos-support.patch ];
16 prePatch = ''
17 patchShebangs ./tools
18
19 substituteInPlace setup.py \
20 --replace /usr $out \
21 --replace /etc $out/etc \
22 --replace /lib/systemd $out/lib/systemd \
23 --replace 'self.init_system = ""' 'self.init_system = "systemd"'
24
25 substituteInPlace cloudinit/config/cc_growpart.py \
26 --replace 'util.subp(["growpart"' 'util.subp(["${cloud-utils}/bin/growpart"'
27
28 # Argparse is part of python stdlib
29 sed -i s/argparse// requirements.txt
30 '';
31
32 propagatedBuildInputs = with pythonPackages; [ cheetah jinja2 prettytable
33 oauthlib pyserial configobj pyyaml requests jsonpatch ];
34
35 checkInputs = with pythonPackages; [ contextlib2 httpretty mock unittest2 ];
36
37 doCheck = false;
38
39 meta = {
40 homepage = https://cloudinit.readthedocs.org;
41 description = "Provides configuration and customization of cloud instance";
42 maintainers = [ lib.maintainers.madjar lib.maintainers.phile314 ];
43 platforms = lib.platforms.all;
44 };
45}