mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-03-14 08:26:37 +01:00
71 lines
1.8 KiB
Nix
71 lines
1.8 KiB
Nix
{
|
|
lib,
|
|
fetchFromGitHub,
|
|
buildPythonPackage,
|
|
bash,
|
|
bashInteractive,
|
|
util-linux,
|
|
setuptools,
|
|
distro,
|
|
udevCheckHook,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "google-compute-engine";
|
|
version = "20190124";
|
|
format = "setuptools";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "GoogleCloudPlatform";
|
|
repo = "compute-image-packages";
|
|
rev = version;
|
|
sha256 = "08cy0jd463kng6hwbd3nfldsp4dpd2lknlvdm88cq795wy0kh4wp";
|
|
};
|
|
|
|
buildInputs = [ bash ];
|
|
propagatedBuildInputs = [
|
|
setuptools
|
|
distro
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
udevCheckHook
|
|
];
|
|
|
|
postPatch = ''
|
|
for file in $(find google_compute_engine -type f); do
|
|
substituteInPlace "$file" \
|
|
--replace /bin/systemctl "/run/current-system/systemd/bin/systemctl" \
|
|
--replace /bin/bash "${bashInteractive}/bin/bash" \
|
|
--replace /sbin/hwclock "${util-linux}/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 "${util-linux}/bin/umount" \
|
|
--replace /usr/bin/logger "${util-linux}/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
|
|
|
|
# sysctl snippets will be used by google-compute-config.nix
|
|
mkdir -p $out/sysctl.d
|
|
cp google_config/sysctl/*.conf $out/sysctl.d
|
|
|
|
patchShebangs $out/bin/*
|
|
'';
|
|
|
|
pythonImportsCheck = [ "google_compute_engine" ];
|
|
|
|
meta = {
|
|
description = "Google Compute Engine tools and services";
|
|
homepage = "https://github.com/GoogleCloudPlatform/compute-image-packages";
|
|
license = lib.licenses.asl20;
|
|
maintainers = with lib.maintainers; [ zimbatm ];
|
|
platforms = lib.platforms.linux;
|
|
};
|
|
}
|