nixpkgs/pkgs/tools/virtualization/cloud-init/default.nix

88 lines
1.8 KiB
Nix
Raw Normal View History

2020-08-18 08:33:47 +00:00
{ lib
, fetchFromGitHub
, buildPythonApplication
, jinja2
, oauthlib
, configobj
, pyyaml
, requests
, jsonschema
, jsonpatch
, httpretty
, dmidecode
, pytestCheckHook
, shadow
, cloud-utils
, openssh
}:
buildPythonApplication rec {
2019-08-13 21:52:01 +00:00
pname = "cloud-init";
version = "20.3";
namePrefix = "";
2020-08-18 08:33:47 +00:00
src = fetchFromGitHub {
owner = "canonical";
repo = "cloud-init";
rev = version;
sha256 = "1fmckxf4q4sxjqs758vw7ca0rnhl9hyq67cqpqzz2v3s1gqzjhm4";
};
2020-08-18 08:33:47 +00:00
patches = [ ./0001-add-nixos-support.patch ];
prePatch = ''
2020-08-18 08:33:47 +00:00
substituteInPlace setup.py --replace /lib/systemd $out/lib/systemd
'';
2020-08-18 08:33:47 +00:00
postInstall = ''
install -D -m755 ./tools/write-ssh-key-fingerprints $out/libexec/write-ssh-key-fingerprints
for i in $out/libexec/*; do
wrapProgram $i --prefix PATH : "${lib.makeBinPath [ openssh ]}"
done
'';
2017-04-21 10:48:02 +00:00
2020-08-18 08:33:47 +00:00
propagatedBuildInputs = [
jinja2
oauthlib
configobj
pyyaml
requests
jsonschema
jsonpatch
];
2020-08-18 08:33:47 +00:00
checkInputs = [
pytestCheckHook
httpretty
dmidecode
# needed for tests; at runtime we rather want the setuid wrapper
shadow
];
2020-08-18 08:33:47 +00:00
makeWrapperArgs = [
"--prefix PATH : ${lib.makeBinPath [
dmidecode cloud-utils.guest
]}/bin"
];
2020-08-18 08:33:47 +00:00
disabledTests = [
# tries to create /var
"test_dhclient_run_with_tmpdir"
# clears path and fails because mkdir is not found
"test_path_env_gets_set_from_main"
# tries to read from /etc/ca-certificates.conf while inside the sandbox
"test_handler_ca_certs"
2020-08-18 08:33:47 +00:00
];
2017-12-11 11:04:06 +00:00
2020-08-18 08:33:47 +00:00
preCheck = ''
# TestTempUtils.test_mkdtemp_default_non_root does not like TMPDIR=/build
export TMPDIR=/tmp
'';
2017-12-11 11:04:06 +00:00
meta = with lib; {
homepage = "https://cloudinit.readthedocs.org";
description = "Provides configuration and customization of cloud instance";
maintainers = with maintainers; [ madjar phile314 ];
platforms = platforms.all;
};
}