2020-10-16 20:44:37 +00:00
|
|
|
{ lib
|
2022-02-10 20:34:41 +00:00
|
|
|
, nixosTests
|
2020-10-16 20:44:37 +00:00
|
|
|
, buildPythonApplication
|
|
|
|
, cloud-utils
|
2021-12-06 16:07:01 +00:00
|
|
|
, dmidecode
|
|
|
|
, fetchFromGitHub
|
2022-02-10 20:34:41 +00:00
|
|
|
, iproute2
|
2020-10-16 20:44:37 +00:00
|
|
|
, openssh
|
2021-12-06 16:07:01 +00:00
|
|
|
, python3
|
|
|
|
, shadow
|
2022-02-10 20:34:41 +00:00
|
|
|
, systemd
|
2022-10-30 15:09:59 +00:00
|
|
|
, coreutils
|
2023-04-29 16:46:19 +00:00
|
|
|
, gitUpdater
|
|
|
|
, busybox
|
2023-10-09 19:29:22 +00:00
|
|
|
, procps
|
2020-10-16 20:44:37 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
python3.pkgs.buildPythonApplication rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "cloud-init";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "23.3.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
namePrefix = "";
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "canonical";
|
|
|
|
repo = "cloud-init";
|
2022-11-04 12:27:35 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-49UvGrv40hyR3A2BndlQKwQqCC1ZaLm97IUKNW12sJo=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
patches = [
|
|
|
|
./0001-add-nixos-support.patch
|
|
|
|
];
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
prePatch = ''
|
2021-12-06 16:07:01 +00:00
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace /lib/systemd $out/lib/systemd
|
2022-02-10 20:34:41 +00:00
|
|
|
|
|
|
|
substituteInPlace cloudinit/net/networkd.py \
|
2022-10-30 15:09:59 +00:00
|
|
|
--replace '["/usr/sbin", "/bin"]' '["/usr/sbin", "/bin", "${iproute2}/bin", "${systemd}/bin"]'
|
2022-02-10 20:34:41 +00:00
|
|
|
|
|
|
|
substituteInPlace tests/unittests/test_net_activators.py \
|
2022-10-30 15:09:59 +00:00
|
|
|
--replace '["/usr/sbin", "/bin"]' \
|
|
|
|
'["/usr/sbin", "/bin", "${iproute2}/bin", "${systemd}/bin"]'
|
|
|
|
|
|
|
|
substituteInPlace tests/unittests/cmd/test_clean.py \
|
|
|
|
--replace "/bin/bash" "/bin/sh"
|
2020-10-16 20:44:37 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-10-16 20:44:37 +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
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
propagatedBuildInputs = with python3.pkgs; [
|
|
|
|
configobj
|
2020-10-16 20:44:37 +00:00
|
|
|
jinja2
|
2021-12-06 16:07:01 +00:00
|
|
|
jsonpatch
|
|
|
|
jsonschema
|
|
|
|
netifaces
|
2020-10-16 20:44:37 +00:00
|
|
|
oauthlib
|
2022-06-16 17:23:12 +00:00
|
|
|
pyserial
|
2020-10-16 20:44:37 +00:00
|
|
|
pyyaml
|
|
|
|
requests
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = with python3.pkgs; [
|
2020-10-16 20:44:37 +00:00
|
|
|
pytestCheckHook
|
|
|
|
httpretty
|
|
|
|
dmidecode
|
|
|
|
# needed for tests; at runtime we rather want the setuid wrapper
|
2023-10-09 19:29:22 +00:00
|
|
|
passlib
|
2020-10-16 20:44:37 +00:00
|
|
|
shadow
|
2022-10-30 15:09:59 +00:00
|
|
|
responses
|
|
|
|
pytest-mock
|
|
|
|
coreutils
|
2023-10-09 19:29:22 +00:00
|
|
|
procps
|
2020-10-16 20:44:37 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
makeWrapperArgs = [
|
2023-04-29 16:46:19 +00:00
|
|
|
"--prefix PATH : ${lib.makeBinPath [ dmidecode cloud-utils.guest busybox ]}/bin"
|
2020-10-16 20:44:37 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
disabledTests = [
|
|
|
|
# tries to create /var
|
|
|
|
"test_dhclient_run_with_tmpdir"
|
2023-10-09 19:29:22 +00:00
|
|
|
"test_dhcp_client_failover"
|
2020-10-16 20:44:37 +00:00
|
|
|
# clears path and fails because mkdir is not found
|
|
|
|
"test_path_env_gets_set_from_main"
|
2023-10-09 19:29:22 +00:00
|
|
|
# fails to find cat
|
|
|
|
"test_subp_combined_stderr_stdout"
|
2020-10-16 20:44:37 +00:00
|
|
|
# tries to read from /etc/ca-certificates.conf while inside the sandbox
|
|
|
|
"test_handler_ca_certs"
|
2023-04-29 16:46:19 +00:00
|
|
|
"TestRemoveDefaultCaCerts"
|
2021-07-14 22:03:04 +00:00
|
|
|
# Doesn't work in the sandbox
|
|
|
|
"TestEphemeralDhcpNoNetworkSetup"
|
|
|
|
"TestHasURLConnectivity"
|
|
|
|
"TestReadFileOrUrl"
|
|
|
|
"TestConsumeUserDataHttp"
|
|
|
|
# Chef Omnibus
|
|
|
|
"TestInstallChefOmnibus"
|
2021-08-05 21:33:18 +00:00
|
|
|
# https://github.com/canonical/cloud-init/pull/893
|
|
|
|
"TestGetPackageMirrorInfo"
|
2021-12-06 16:07:01 +00:00
|
|
|
# Disable failing VMware and PuppetAio tests
|
|
|
|
"test_get_data_iso9660_with_network_config"
|
|
|
|
"test_get_data_vmware_guestinfo_with_network_config"
|
|
|
|
"test_get_host_info"
|
|
|
|
"test_no_data_access_method"
|
|
|
|
"test_install_with_collection"
|
|
|
|
"test_install_with_custom_url"
|
|
|
|
"test_install_with_default_arguments"
|
|
|
|
"test_install_with_no_cleanup"
|
|
|
|
"test_install_with_version"
|
2021-07-14 22:03:04 +00:00
|
|
|
];
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
preCheck = ''
|
|
|
|
# TestTempUtils.test_mkdtemp_default_non_root does not like TMPDIR=/build
|
|
|
|
export TMPDIR=/tmp
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"cloudinit"
|
|
|
|
];
|
2021-07-14 22:03:04 +00:00
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
passthru = {
|
|
|
|
tests = { inherit (nixosTests) cloud-init cloud-init-hostname; };
|
|
|
|
updateScript = gitUpdater { ignoredVersions = ".ubuntu.*"; };
|
|
|
|
};
|
2022-02-10 20:34:41 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
meta = with lib; {
|
2023-04-29 16:46:19 +00:00
|
|
|
homepage = "https://github.com/canonical/cloud-init";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Provides configuration and customization of cloud instance";
|
2023-07-15 17:15:38 +00:00
|
|
|
changelog = "https://github.com/canonical/cloud-init/raw/${version}/ChangeLog";
|
2021-08-23 08:02:39 +00:00
|
|
|
license = with licenses; [ asl20 gpl3Plus ];
|
2023-04-29 16:46:19 +00:00
|
|
|
maintainers = with maintainers; [ illustris jfroche ];
|
2021-03-09 03:18:52 +00:00
|
|
|
platforms = platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|