nixpkgs-suyu/pkgs/tools/virtualization/google-compute-engine/default.nix

106 lines
2.6 KiB
Nix
Raw Normal View History

{ lib
, fetchFromGitHub
, buildPythonPackage
, bash
2018-12-04 05:38:54 +01:00
, bashInteractive
2020-11-24 16:29:28 +01:00
, util-linux
, boto
, setuptools
, distro
, stdenv
, pythonOlder
, pytestCheckHook
}:
let
guest-configs = stdenv.mkDerivation rec {
pname = "guest-configs";
version = "20210702.00";
src = fetchFromGitHub {
owner = "GoogleCloudPlatform";
repo = "guest-configs";
rev = version;
sha256 = "1965kdrb1ig3z4qwzvyzx1fb4282ak5vgxcvvg5k9c759pzbc5nn";
};
buildInputs = [ bash ];
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
# allows to install the package in `services.udev.packages` in NixOS
mkdir -p $out/lib/udev $out/bin
cp -r "src/lib/udev/rules.d" $out/lib/udev
cp "src/lib/udev/google_nvme_id" $out/bin
for rules in $out/lib/udev/*.rules; do
substituteInPlace "$rules" \
--replace /bin/sh "${bash}/bin/sh" \
--replace /bin/umount "${util-linux}/bin/umount" \
--replace /usr/bin/logger "${util-linux}/bin/logger"
done
# sysctl snippets will be used by google-compute-config.nix
cp -r "src/etc/sysctl.d" $out
patchShebangs $out/bin/*
runHook postInstall
'';
};
in
buildPythonPackage rec {
pname = "google-compute-engine";
version = "20200113.0";
src = fetchFromGitHub {
owner = "GoogleCloudPlatform";
repo = "compute-image-packages";
rev = "506b9a0dbffec5620887660cd42c57b3cbbadba6";
sha256 = "0lmc426mvrajghpavhs6hwl19mgnnh08ziqx5yi15fzpnvwmb8vz";
};
buildInputs = [ bash guest-configs ];
propagatedBuildInputs = [ (if pythonOlder "3.7" then boto else distro) setuptools ];
preBuild = ''
cd packages/python-google-compute-engine
'';
disabledTests = [
"testExtractInterfaceMetadata"
"testCallDhclientIpv6"
"testWriteConfig"
"testCreateInterfaceMapNetifaces"
"testCreateInterfaceMapSysfs"
"testGetNetworkInterface"
];
checkInputs = [ pytestCheckHook ];
postPatch = ''
for file in $(find google_compute_engine -type f); do
substituteInPlace "$file" \
--replace /bin/systemctl "/run/current-system/systemd/bin/systemctl" \
2018-12-04 05:38:54 +01:00
--replace /bin/bash "${bashInteractive}/bin/bash" \
2020-11-24 16:29:28 +01:00
--replace /sbin/hwclock "${util-linux}/bin/hwclock"
# SELinux tool ??? /sbin/restorecon
done
'';
pythonImportsCheck = [ "google_compute_engine" ];
meta = with lib; {
description = "Google Compute Engine tools and services";
homepage = "https://github.com/GoogleCloudPlatform/compute-image-packages";
license = licenses.asl20;
maintainers = with maintainers; [ cpcloud zimbatm ];
google-compute-engine: 20170914 -> 20180129 (#36565) Semi-automatic update. These checks were done: - built on NixOS - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/optimize_local_ssd -h` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/optimize_local_ssd --help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/optimize_local_ssd help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/set_multiqueue -h` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/set_multiqueue --help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/set_multiqueue help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/set_multiqueue -V` and found version 20180129 - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/set_multiqueue -v` and found version 20180129 - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/set_multiqueue --version` and found version 20180129 - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/set_multiqueue version` and found version 20180129 - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/set_multiqueue -h` and found version 20180129 - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/set_multiqueue --help` and found version 20180129 - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/set_multiqueue help` and found version 20180129 - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/.google_accounts_daemon-wrapped -h` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/.google_accounts_daemon-wrapped --help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/google_accounts_daemon -h` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/google_accounts_daemon --help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/.google_instance_setup-wrapped -h` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/.google_instance_setup-wrapped --help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/google_instance_setup -h` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/google_instance_setup --help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/.google_network_setup-wrapped -h` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/.google_network_setup-wrapped --help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/google_network_setup -h` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/google_network_setup --help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/.google_ip_forwarding_daemon-wrapped -h` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/.google_ip_forwarding_daemon-wrapped --help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/.google_ip_forwarding_daemon-wrapped help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/google_ip_forwarding_daemon -h` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/google_ip_forwarding_daemon --help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/google_ip_forwarding_daemon help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/.google_clock_skew_daemon-wrapped -h` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/.google_clock_skew_daemon-wrapped --help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/.google_clock_skew_daemon-wrapped help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/google_clock_skew_daemon -h` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/google_clock_skew_daemon --help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/google_clock_skew_daemon help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/.google_metadata_script_runner-wrapped -h` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/.google_metadata_script_runner-wrapped --help` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/google_metadata_script_runner -h` got 0 exit code - ran `/nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129/bin/google_metadata_script_runner --help` got 0 exit code - found 20180129 with grep in /nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129 - found 20180129 in filename of file in /nix/store/xxf54yjdmhkmsy5h0rrh985lygpi3sjv-google-compute-engine-20180129 only build on Linux
2018-04-23 23:03:19 +02:00
platforms = platforms.linux;
};
}