Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 23.11-beta 139 lines 3.6 kB view raw
1{ lib 2, nixosTests 3, buildPythonApplication 4, cloud-utils 5, dmidecode 6, fetchFromGitHub 7, iproute2 8, openssh 9, python3 10, shadow 11, systemd 12, coreutils 13, gitUpdater 14, busybox 15, procps 16}: 17 18python3.pkgs.buildPythonApplication rec { 19 pname = "cloud-init"; 20 version = "23.3.3"; 21 namePrefix = ""; 22 23 src = fetchFromGitHub { 24 owner = "canonical"; 25 repo = "cloud-init"; 26 rev = "refs/tags/${version}"; 27 hash = "sha256-49UvGrv40hyR3A2BndlQKwQqCC1ZaLm97IUKNW12sJo="; 28 }; 29 30 patches = [ 31 ./0001-add-nixos-support.patch 32 ]; 33 34 prePatch = '' 35 substituteInPlace setup.py \ 36 --replace /lib/systemd $out/lib/systemd 37 38 substituteInPlace cloudinit/net/networkd.py \ 39 --replace '["/usr/sbin", "/bin"]' '["/usr/sbin", "/bin", "${iproute2}/bin", "${systemd}/bin"]' 40 41 substituteInPlace tests/unittests/test_net_activators.py \ 42 --replace '["/usr/sbin", "/bin"]' \ 43 '["/usr/sbin", "/bin", "${iproute2}/bin", "${systemd}/bin"]' 44 45 substituteInPlace tests/unittests/cmd/test_clean.py \ 46 --replace "/bin/bash" "/bin/sh" 47 ''; 48 49 postInstall = '' 50 install -D -m755 ./tools/write-ssh-key-fingerprints $out/libexec/write-ssh-key-fingerprints 51 for i in $out/libexec/*; do 52 wrapProgram $i --prefix PATH : "${lib.makeBinPath [ openssh ]}" 53 done 54 ''; 55 56 propagatedBuildInputs = with python3.pkgs; [ 57 configobj 58 jinja2 59 jsonpatch 60 jsonschema 61 netifaces 62 oauthlib 63 pyserial 64 pyyaml 65 requests 66 ]; 67 68 nativeCheckInputs = with python3.pkgs; [ 69 pytestCheckHook 70 httpretty 71 dmidecode 72 # needed for tests; at runtime we rather want the setuid wrapper 73 passlib 74 shadow 75 responses 76 pytest-mock 77 coreutils 78 procps 79 ]; 80 81 makeWrapperArgs = [ 82 "--prefix PATH : ${lib.makeBinPath [ dmidecode cloud-utils.guest busybox ]}/bin" 83 ]; 84 85 disabledTests = [ 86 # tries to create /var 87 "test_dhclient_run_with_tmpdir" 88 "test_dhcp_client_failover" 89 # clears path and fails because mkdir is not found 90 "test_path_env_gets_set_from_main" 91 # fails to find cat 92 "test_subp_combined_stderr_stdout" 93 # tries to read from /etc/ca-certificates.conf while inside the sandbox 94 "test_handler_ca_certs" 95 "TestRemoveDefaultCaCerts" 96 # Doesn't work in the sandbox 97 "TestEphemeralDhcpNoNetworkSetup" 98 "TestHasURLConnectivity" 99 "TestReadFileOrUrl" 100 "TestConsumeUserDataHttp" 101 # Chef Omnibus 102 "TestInstallChefOmnibus" 103 # https://github.com/canonical/cloud-init/pull/893 104 "TestGetPackageMirrorInfo" 105 # Disable failing VMware and PuppetAio tests 106 "test_get_data_iso9660_with_network_config" 107 "test_get_data_vmware_guestinfo_with_network_config" 108 "test_get_host_info" 109 "test_no_data_access_method" 110 "test_install_with_collection" 111 "test_install_with_custom_url" 112 "test_install_with_default_arguments" 113 "test_install_with_no_cleanup" 114 "test_install_with_version" 115 ]; 116 117 preCheck = '' 118 # TestTempUtils.test_mkdtemp_default_non_root does not like TMPDIR=/build 119 export TMPDIR=/tmp 120 ''; 121 122 pythonImportsCheck = [ 123 "cloudinit" 124 ]; 125 126 passthru = { 127 tests = { inherit (nixosTests) cloud-init cloud-init-hostname; }; 128 updateScript = gitUpdater { ignoredVersions = ".ubuntu.*"; }; 129 }; 130 131 meta = with lib; { 132 homepage = "https://github.com/canonical/cloud-init"; 133 description = "Provides configuration and customization of cloud instance"; 134 changelog = "https://github.com/canonical/cloud-init/raw/${version}/ChangeLog"; 135 license = with licenses; [ asl20 gpl3Plus ]; 136 maintainers = with maintainers; [ illustris jfroche ]; 137 platforms = platforms.all; 138 }; 139}