2023-07-25 20:33:22 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
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 {
|
2022-01-10 13:39:16 +00:00
|
|
|
pname = "google-guest-oslogin";
|
2023-09-20 05:37:08 +00:00
|
|
|
version = "20230831.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;
|
2023-09-20 05:37:08 +00:00
|
|
|
sha256 = "sha256-9QCB94HVbeLjioJuSN1Aa+EqFncojPoWFxw5mS9bDGw=";
|
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"
|
2022-01-10 13:39:16 +00:00
|
|
|
substituteInPlace src/include/compat.h --replace /bin/bash /run/current-system/sw/bin/bash
|
2018-12-12 12:52:51 +00:00
|
|
|
'';
|
|
|
|
|
2022-01-10 13:39:16 +00:00
|
|
|
buildInputs = [ curl.dev pam json_c ];
|
2018-12-12 12:52:51 +00:00
|
|
|
|
2023-02-19 19:23:32 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [ "-I${json_c.dev}/include/json-c" ];
|
2018-12-12 12:52:51 +00:00
|
|
|
|
2020-04-01 12:01:41 +00:00
|
|
|
makeFlags = [
|
|
|
|
"VERSION=${version}"
|
2022-01-10 13:39:16 +00:00
|
|
|
"PREFIX=$(out)"
|
|
|
|
"MANDIR=$(out)/share/man"
|
|
|
|
"SYSTEMDDIR=$(out)/etc/systemd/system"
|
|
|
|
"PRESETDIR=$(out)/etc/systemd/system-preset"
|
2020-04-01 12:01:41 +00:00
|
|
|
];
|
2018-12-12 12:52:51 +00:00
|
|
|
|
2022-01-10 13:39:16 +00:00
|
|
|
postInstall = ''
|
|
|
|
sed -i "s,/usr/bin/,$out/bin/,g" $out/etc/systemd/system/google-oslogin-cache.service
|
|
|
|
'';
|
|
|
|
|
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;
|
2022-01-10 13:39:16 +00:00
|
|
|
platforms = platforms.linux;
|
2020-05-21 16:06:04 +00:00
|
|
|
maintainers = with maintainers; [ flokli ];
|
2018-12-12 12:52:51 +00:00
|
|
|
};
|
|
|
|
}
|