2017-05-29 15:32:48 +01:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
2017-09-17 06:20:30 +01:00
|
|
|
, buildPythonApplication
|
2017-05-29 15:32:48 +01:00
|
|
|
, bash
|
|
|
|
, shadow
|
|
|
|
, systemd
|
|
|
|
, utillinux
|
2017-09-17 06:20:30 +01:00
|
|
|
, boto
|
|
|
|
, setuptools
|
2017-05-29 15:32:48 +01:00
|
|
|
}:
|
2017-09-17 06:20:30 +01:00
|
|
|
|
|
|
|
buildPythonApplication rec {
|
2017-05-29 15:32:48 +01:00
|
|
|
name = "google-compute-engine-${version}";
|
2017-09-17 06:20:30 +01:00
|
|
|
version = "20170914";
|
2017-05-29 15:32:48 +01:00
|
|
|
namePrefix = "";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "GoogleCloudPlatform";
|
|
|
|
repo = "compute-image-packages";
|
|
|
|
rev = version;
|
2017-09-17 06:20:30 +01:00
|
|
|
sha256 = "0hlzcrf6yhzan25f4wzy1vbncak9whhqzrzza026ly3sq0smmjpg";
|
2017-05-29 15:32:48 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
for file in $(find google_compute_engine -type f); do
|
|
|
|
substituteInPlace "$file" \
|
|
|
|
--replace /bin/systemctl "${systemd}/bin/systemctl" \
|
|
|
|
--replace /bin/bash "${bash}/bin/bash" \
|
|
|
|
--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
|
|
|
|
'';
|
|
|
|
|
2017-09-17 06:20:30 +01:00
|
|
|
propagatedBuildInputs = [ boto setuptools ];
|
2017-05-29 15:32:48 +01:00
|
|
|
|
2017-12-21 18:36:20 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
2017-05-29 15:32:48 +01:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Google Compute Engine tools and services";
|
2017-09-17 06:20:30 +01:00
|
|
|
homepage = "https://github.com/GoogleCloudPlatform/compute-image-packages";
|
2017-05-29 15:32:48 +01:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ zimbatm ];
|
|
|
|
};
|
|
|
|
}
|