2022-02-10 20:34:41 +00:00
|
|
|
{ buildGoModule, fetchFromGitHub, fetchpatch, lib, coreutils, makeWrapper
|
|
|
|
, google-guest-configs, google-guest-oslogin, iproute2, dhcp, procps
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "guest-agent";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "20230707.00";
|
2022-02-10 20:34:41 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "GoogleCloudPlatform";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2023-07-15 17:15:38 +00:00
|
|
|
sha256 = "sha256-lGybidp/dZRe65L2fQlNTNHYNmMDrbYfBPeC9isER2I=";
|
2022-02-10 20:34:41 +00:00
|
|
|
};
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
vendorHash = "sha256-ULGpgygBVC4SRLhPiUlZgBH93w84WlNbvq3S7cVHLaQ=";
|
2022-02-10 20:34:41 +00:00
|
|
|
|
|
|
|
patches = [ ./disable-etc-mutation.patch ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substitute ${./fix-paths.patch} fix-paths.patch \
|
|
|
|
--subst-var out \
|
|
|
|
--subst-var-by true "${coreutils}/bin/true"
|
|
|
|
patch -p1 < ./fix-paths.patch
|
|
|
|
'';
|
|
|
|
|
|
|
|
# We don't add `shadow` here; it's added to PATH if `mutableUsers` is enabled.
|
|
|
|
binPath = lib.makeBinPath [ google-guest-configs google-guest-oslogin iproute2 dhcp procps ];
|
|
|
|
|
|
|
|
# Skip tests which require networking.
|
|
|
|
preCheck = ''
|
|
|
|
rm google_guest_agent/wsfc_test.go
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/etc/systemd/system
|
|
|
|
cp *.service $out/etc/systemd/system
|
|
|
|
install -Dm644 instance_configs.cfg $out/etc/default/instance_configs.cfg
|
|
|
|
|
|
|
|
wrapProgram $out/bin/google_guest_agent \
|
|
|
|
--prefix PATH ":" "$binPath"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/GoogleCloudPlatform/guest-agent";
|
|
|
|
description = "Guest Agent for Google Compute Engine";
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ abbradar ];
|
|
|
|
};
|
|
|
|
}
|