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
|
2018-12-04 04:38:54 +00:00
|
|
|
, bashInteractive
|
2017-05-29 15:32:48 +01:00
|
|
|
, systemd
|
2020-11-24 15:29:28 +00:00
|
|
|
, util-linux
|
2017-09-17 06:20:30 +01:00
|
|
|
, boto
|
|
|
|
, setuptools
|
2018-09-24 14:50:52 +01:00
|
|
|
, distro
|
2017-05-29 15:32:48 +01:00
|
|
|
}:
|
2017-09-17 06:20:30 +01:00
|
|
|
|
|
|
|
buildPythonApplication rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "google-compute-engine";
|
2019-02-06 11:02:31 +00:00
|
|
|
version = "20190124";
|
2017-05-29 15:32:48 +01:00
|
|
|
namePrefix = "";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "GoogleCloudPlatform";
|
|
|
|
repo = "compute-image-packages";
|
|
|
|
rev = version;
|
2019-02-06 11:02:31 +00:00
|
|
|
sha256 = "08cy0jd463kng6hwbd3nfldsp4dpd2lknlvdm88cq795wy0kh4wp";
|
2017-05-29 15:32:48 +01:00
|
|
|
};
|
|
|
|
|
2019-08-31 23:27:56 +01:00
|
|
|
buildInputs = [ bash ];
|
|
|
|
propagatedBuildInputs = [ boto setuptools distro ];
|
|
|
|
|
|
|
|
|
2017-05-29 15:32:48 +01:00
|
|
|
postPatch = ''
|
|
|
|
for file in $(find google_compute_engine -type f); do
|
|
|
|
substituteInPlace "$file" \
|
2020-05-21 09:35:34 +01:00
|
|
|
--replace /bin/systemctl "/run/current-system/systemd/bin/systemctl" \
|
2018-12-04 04:38:54 +00:00
|
|
|
--replace /bin/bash "${bashInteractive}/bin/bash" \
|
2020-11-24 15:29:28 +00:00
|
|
|
--replace /sbin/hwclock "${util-linux}/bin/hwclock"
|
2017-05-29 15:32:48 +01:00
|
|
|
# SELinux tool ??? /sbin/restorecon
|
|
|
|
done
|
|
|
|
|
|
|
|
substituteInPlace google_config/udev/64-gce-disk-removal.rules \
|
|
|
|
--replace /bin/sh "${bash}/bin/sh" \
|
2020-11-24 15:29:28 +00:00
|
|
|
--replace /bin/umount "${util-linux}/bin/umount" \
|
|
|
|
--replace /usr/bin/logger "${util-linux}/bin/logger"
|
2017-05-29 15:32:48 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2019-09-01 01:55:28 +01:00
|
|
|
# sysctl snippets will be used by google-compute-config.nix
|
|
|
|
mkdir -p $out/sysctl.d
|
|
|
|
cp google_config/sysctl/*.conf $out/sysctl.d
|
|
|
|
|
2019-08-31 23:27:56 +01:00
|
|
|
patchShebangs $out/bin/*
|
|
|
|
'';
|
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 ];
|
2018-04-23 22:03:19 +01:00
|
|
|
platforms = platforms.linux;
|
2017-05-29 15:32:48 +01:00
|
|
|
};
|
|
|
|
}
|