at 17.09-beta 55 lines 1.5 kB view raw
1{ lib 2, fetchFromGitHub 3, pythonPackages 4, bash 5, shadow 6, systemd 7, utillinux 8}: 9let 10 version = "20170523"; 11in 12pythonPackages.buildPythonApplication { 13 name = "google-compute-engine-${version}"; 14 namePrefix = ""; 15 16 src = fetchFromGitHub { 17 owner = "GoogleCloudPlatform"; 18 repo = "compute-image-packages"; 19 rev = version; 20 sha256 = "1qxyj3lj9in6m8yi6y6wcmc3662h9z4qax07v97rdnay99mxdv68"; 21 }; 22 23 patches = [ ./0001-allow-nologin-other-paths.patch ]; 24 25 postPatch = '' 26 for file in $(find google_compute_engine -type f); do 27 substituteInPlace "$file" \ 28 --replace /bin/systemctl "${systemd}/bin/systemctl" \ 29 --replace /bin/bash "${bash}/bin/bash" \ 30 --replace /sbin/hwclock "${utillinux}/bin/hwclock" 31 32 # SELinux tool ??? /sbin/restorecon 33 done 34 35 substituteInPlace google_config/udev/64-gce-disk-removal.rules \ 36 --replace /bin/sh "${bash}/bin/sh" \ 37 --replace /bin/umount "${utillinux}/bin/umount" \ 38 --replace /usr/bin/logger "${utillinux}/bin/logger" 39 ''; 40 41 postInstall = '' 42 # allows to install the package in `services.udev.packages` in NixOS 43 mkdir -p $out/lib/udev/rules.d 44 cp -r google_config/udev/*.rules $out/lib/udev/rules.d 45 ''; 46 47 propagatedBuildInputs = with pythonPackages; [ boto setuptools ]; 48 49 meta = with lib; { 50 description = "Google Compute Engine tools and services"; 51 homepage = https://github.com/GoogleCloudPlatform/compute-image-packages; 52 license = licenses.asl20; 53 maintainers = with maintainers; [ zimbatm ]; 54 }; 55}