depot/third_party/nixpkgs/pkgs/tools/virtualization/google-guest-agent/default.nix
Default email 5e9e1146e1 Project import generated by Copybara.
GitOrigin-RevId: 18036c0be90f4e308ae3ebcab0e14aae0336fe42
2023-08-05 00:07:22 +02:00

53 lines
1.5 KiB
Nix

{ buildGoModule, fetchFromGitHub, lib, coreutils, makeWrapper
, google-guest-configs, google-guest-oslogin, iproute2, procps
}:
buildGoModule rec {
pname = "guest-agent";
version = "20230726.00";
src = fetchFromGitHub {
owner = "GoogleCloudPlatform";
repo = pname;
rev = version;
sha256 = "sha256-p+gjiaUaBBGhCVkbXrubfV/xZWvanC8ktlfIfjyUQSA=";
};
vendorHash = "sha256-Xw/5yHW9DRtZFC6cECLI0RncgzSGB5/Y0yjW7hz247s=";
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 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 ];
};
}