2018-12-12 12:52:51 +00:00
|
|
|
{ stdenv
|
2020-04-01 12:01:41 +00:00
|
|
|
, lib
|
2020-05-21 16:49:26 +00:00
|
|
|
, bashInteractive
|
2018-12-12 12:52:51 +00:00
|
|
|
, curl
|
2020-05-21 16:49:26 +00:00
|
|
|
, fetchFromGitHub
|
2018-12-12 12:52:51 +00:00
|
|
|
, json_c
|
2020-05-21 16:49:26 +00:00
|
|
|
, nixosTests
|
2018-12-12 12:52:51 +00:00
|
|
|
, pam
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "google-compute-engine-oslogin";
|
2020-05-21 11:26:16 +00:00
|
|
|
version = "20200507.00";
|
2018-12-12 12:52:51 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "GoogleCloudPlatform";
|
2020-04-01 12:01:41 +00:00
|
|
|
repo = "guest-oslogin";
|
|
|
|
rev = version;
|
2020-05-21 11:26:16 +00:00
|
|
|
sha256 = "1np8c96sm29pwnxykc0id8kkgalhw576g43fgi1y936sr2hfvx3v";
|
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)
|
2020-04-01 12:01:41 +00:00
|
|
|
substituteInPlace src/pam/pam_oslogin_admin.cc --replace /var/google-sudoers.d /run/google-sudoers.d
|
2018-12-12 12:52:51 +00:00
|
|
|
# fix "User foo not allowed because shell /bin/bash does not exist"
|
2020-04-01 12:01:41 +00:00
|
|
|
substituteInPlace src/include/compat.h --replace /bin/bash ${bashInteractive}/bin/bash
|
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";
|
|
|
|
|
2020-04-01 12:01:41 +00:00
|
|
|
makeFlags = [
|
|
|
|
"VERSION=${version}"
|
|
|
|
"DESTDIR=${placeholder "out"}"
|
|
|
|
"PREFIX=/"
|
|
|
|
"BINDIR=/bin"
|
|
|
|
"LIBDIR=/lib"
|
|
|
|
"PAMDIR=/lib"
|
|
|
|
"MANDIR=/share/man"
|
|
|
|
];
|
2018-12-12 12:52:51 +00:00
|
|
|
|
2019-07-29 16:01:50 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2020-05-21 16:49:26 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit (nixosTests) google-oslogin;
|
|
|
|
};
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/GoogleCloudPlatform/compute-image-packages";
|
2018-12-12 12:52:51 +00:00
|
|
|
description = "OS Login Guest Environment for Google Compute Engine";
|
|
|
|
license = licenses.asl20;
|
2020-05-21 16:06:04 +00:00
|
|
|
maintainers = with maintainers; [ flokli ];
|
2018-12-12 12:52:51 +00:00
|
|
|
};
|
|
|
|
}
|