summary refs log tree commit diff
path: root/pkgs/tools/virtualization/google-compute-engine
diff options
context:
space:
mode:
authorzimbatm <zimbatm@zimbatm.com>2017-05-29 15:32:48 +0100
committerzimbatm <zimbatm@zimbatm.com>2017-07-15 18:00:55 +0100
commit812346c9c9d32c08e1928897c50876fa8e375a3a (patch)
tree93bbf60b3009058432a044d27d882ac0daac5322 /pkgs/tools/virtualization/google-compute-engine
parenta5d75f0f18a0af23fe6b01fc971fe2db39db151d (diff)
downloadnixpkgs-812346c9c9d32c08e1928897c50876fa8e375a3a.tar
nixpkgs-812346c9c9d32c08e1928897c50876fa8e375a3a.tar.gz
nixpkgs-812346c9c9d32c08e1928897c50876fa8e375a3a.tar.bz2
nixpkgs-812346c9c9d32c08e1928897c50876fa8e375a3a.tar.lz
nixpkgs-812346c9c9d32c08e1928897c50876fa8e375a3a.tar.xz
nixpkgs-812346c9c9d32c08e1928897c50876fa8e375a3a.tar.zst
nixpkgs-812346c9c9d32c08e1928897c50876fa8e375a3a.zip
google-compute-engine: init at 20170523
Diffstat (limited to 'pkgs/tools/virtualization/google-compute-engine')
-rw-r--r--pkgs/tools/virtualization/google-compute-engine/0001-allow-nologin-other-paths.patch27
-rw-r--r--pkgs/tools/virtualization/google-compute-engine/default.nix55
2 files changed, 82 insertions, 0 deletions
diff --git a/pkgs/tools/virtualization/google-compute-engine/0001-allow-nologin-other-paths.patch b/pkgs/tools/virtualization/google-compute-engine/0001-allow-nologin-other-paths.patch
new file mode 100644
index 00000000000..650e80c24fb
--- /dev/null
+++ b/pkgs/tools/virtualization/google-compute-engine/0001-allow-nologin-other-paths.patch
@@ -0,0 +1,27 @@
+From 2e9ac201af238b742c7032962b9b12a8b66bab0c Mon Sep 17 00:00:00 2001
+From: zimbatm <zimbatm@zimbatm.com>
+Date: Mon, 29 May 2017 22:36:15 +0100
+Subject: [PATCH] allow nologin on other paths
+
+---
+ google_compute_engine/accounts/accounts_utils.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/google_compute_engine/accounts/accounts_utils.py b/google_compute_engine/accounts/accounts_utils.py
+index 57e62be..d7eda06 100644
+--- a/google_compute_engine/accounts/accounts_utils.py
++++ b/google_compute_engine/accounts/accounts_utils.py
+@@ -295,8 +295,8 @@ class AccountsUtils(object):
+     # logins. This helps avoid problems caused by operator and root sharing
+     # a home directory in CentOS and RHEL.
+     pw_entry = self._GetUser(user)
+-    if pw_entry and pw_entry.pw_shell == '/sbin/nologin':
+-      message = 'Not updating user %s. User set /sbin/nologin as login shell.'
++    if pw_entry and os.path.basename(pw_entry.pw_shell) == 'nologin':
++      message = 'Not updating user %s. User set `nologin` as login shell.'
+       self.logger.debug(message, user)
+       return True
+ 
+-- 
+2.13.0
+
diff --git a/pkgs/tools/virtualization/google-compute-engine/default.nix b/pkgs/tools/virtualization/google-compute-engine/default.nix
new file mode 100644
index 00000000000..7a5350fe2eb
--- /dev/null
+++ b/pkgs/tools/virtualization/google-compute-engine/default.nix
@@ -0,0 +1,55 @@
+{ lib
+, fetchFromGitHub
+, pythonPackages
+, bash
+, shadow
+, systemd
+, utillinux
+}:
+let
+  version = "20170523";
+in
+pythonPackages.buildPythonApplication {
+  name = "google-compute-engine-${version}";
+  namePrefix = "";
+
+  src = fetchFromGitHub {
+    owner = "GoogleCloudPlatform";
+    repo = "compute-image-packages";
+    rev = version;
+    sha256 = "1qxyj3lj9in6m8yi6y6wcmc3662h9z4qax07v97rdnay99mxdv68";
+  };
+
+  patches = [ ./0001-allow-nologin-other-paths.patch ];
+
+  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
+  '';
+
+  propagatedBuildInputs = with pythonPackages; [ boto setuptools ];
+
+  meta = with lib; {
+    description = "Google Compute Engine tools and services";
+    homepage = https://github.com/GoogleCloudPlatform/compute-image-packages;
+    license = licenses.asl20;
+    maintainers = with maintainers; [ zimbatm ];
+  };
+}