2018-12-12 12:52:51 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, curl
|
|
|
|
, json_c
|
|
|
|
, pam
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "google-compute-engine-oslogin-${version}";
|
2019-07-29 16:01:50 +00:00
|
|
|
version = "1.5.3";
|
|
|
|
# from packages/google-compute-engine-oslogin/packaging/debian/changelog
|
2018-12-12 12:52:51 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "GoogleCloudPlatform";
|
2019-07-29 16:01:50 +00:00
|
|
|
repo = "compute-image-packages";
|
|
|
|
rev = "20190522";
|
|
|
|
sha256 = "16jbbrnz49g843h813r408dbvfa2hicf8canxwbfxr2kzhv7ycmm";
|
2018-12-12 12:52:51 +00:00
|
|
|
};
|
2019-07-29 16:01:50 +00:00
|
|
|
sourceRoot = "source/packages/google-compute-engine-oslogin";
|
2018-12-12 12:52:51 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# change sudoers dir from /var/google-sudoers.d to /run/google-sudoers.d (managed through systemd-tmpfiles)
|
|
|
|
substituteInPlace pam_module/pam_oslogin_admin.cc --replace /var/google-sudoers.d /run/google-sudoers.d
|
|
|
|
# fix "User foo not allowed because shell /bin/bash does not exist"
|
2019-07-29 23:28:12 +00:00
|
|
|
substituteInPlace compat.h --replace /bin/bash ${stdenv.shell}
|
2018-12-12 12:52:51 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildInputs = [ curl.dev pam ];
|
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE="-I${json_c.dev}/include/json-c";
|
|
|
|
NIX_CFLAGS_LINK="-L${json_c}/lib";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/{bin,lib}
|
|
|
|
|
|
|
|
install -Dm755 libnss_cache_google-compute-engine-oslogin-${version}.so $out/lib/libnss_cache_oslogin.so.2
|
|
|
|
install -Dm755 libnss_google-compute-engine-oslogin-${version}.so $out/lib/libnss_oslogin.so.2
|
|
|
|
|
|
|
|
install -Dm755 pam_oslogin_admin.so pam_oslogin_login.so $out/lib
|
|
|
|
install -Dm755 google_{oslogin_nss_cache,authorized_keys} $out/bin
|
|
|
|
'';
|
|
|
|
|
2019-07-29 16:01:50 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2018-12-12 12:52:51 +00:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = https://github.com/GoogleCloudPlatform/compute-image-packages;
|
|
|
|
description = "OS Login Guest Environment for Google Compute Engine";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ adisbladis flokli ];
|
|
|
|
};
|
|
|
|
}
|