2017-05-29 16:32:48 +02:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
2017-09-17 07:20:30 +02:00
|
|
|
, buildPythonApplication
|
2017-05-29 16:32:48 +02:00
|
|
|
, bash
|
2018-12-04 05:38:54 +01:00
|
|
|
, bashInteractive
|
2017-05-29 16:32:48 +02:00
|
|
|
, systemd
|
|
|
|
, utillinux
|
2017-09-17 07:20:30 +02:00
|
|
|
, boto
|
|
|
|
, setuptools
|
2018-09-24 15:50:52 +02:00
|
|
|
, distro
|
2017-05-29 16:32:48 +02:00
|
|
|
}:
|
2017-09-17 07:20:30 +02:00
|
|
|
|
|
|
|
buildPythonApplication rec {
|
2017-05-29 16:32:48 +02:00
|
|
|
name = "google-compute-engine-${version}";
|
2019-02-06 12:02:31 +01:00
|
|
|
version = "20190124";
|
2017-05-29 16:32:48 +02:00
|
|
|
namePrefix = "";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "GoogleCloudPlatform";
|
|
|
|
repo = "compute-image-packages";
|
|
|
|
rev = version;
|
2019-02-06 12:02:31 +01:00
|
|
|
sha256 = "08cy0jd463kng6hwbd3nfldsp4dpd2lknlvdm88cq795wy0kh4wp";
|
2017-05-29 16:32:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
for file in $(find google_compute_engine -type f); do
|
|
|
|
substituteInPlace "$file" \
|
|
|
|
--replace /bin/systemctl "${systemd}/bin/systemctl" \
|
2018-12-04 05:38:54 +01:00
|
|
|
--replace /bin/bash "${bashInteractive}/bin/bash" \
|
2017-05-29 16:32:48 +02:00
|
|
|
--replace /sbin/hwclock "${utillinux}/bin/hwclock"
|
|
|
|
|
|
|
|
# SELinux tool ??? /sbin/restorecon
|
|
|
|
done
|
|
|
|
|
|
|
|
substituteInPlace google_config/udev/64-gce-disk-removal.rules \
|
|
|
|
--replace /bin/sh "${bash}/bin/sh" \
|
|
|
|
--replace /bin/umount "${utillinux}/bin/umount" \
|
|
|
|
--replace /usr/bin/logger "${utillinux}/bin/logger"
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# allows to install the package in `services.udev.packages` in NixOS
|
|
|
|
mkdir -p $out/lib/udev/rules.d
|
|
|
|
cp -r google_config/udev/*.rules $out/lib/udev/rules.d
|
|
|
|
'';
|
|
|
|
|
2018-09-24 15:50:52 +02:00
|
|
|
propagatedBuildInputs = [ boto setuptools distro ];
|
2017-05-29 16:32:48 +02:00
|
|
|
|
2017-12-21 19:36:20 +01:00
|
|
|
doCheck = false;
|
|
|
|
|
2017-05-29 16:32:48 +02:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Google Compute Engine tools and services";
|
2017-09-17 07:20:30 +02:00
|
|
|
homepage = "https://github.com/GoogleCloudPlatform/compute-image-packages";
|
2017-05-29 16:32:48 +02:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ zimbatm ];
|
2018-04-23 23:03:19 +02:00
|
|
|
platforms = platforms.linux;
|
2017-05-29 16:32:48 +02:00
|
|
|
};
|
|
|
|
}
|