Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ buildGoModule, fetchFromGitHub, fetchpatch, lib, coreutils, makeWrapper 2, google-guest-configs, google-guest-oslogin, iproute2, dhcp, procps 3}: 4 5buildGoModule rec { 6 pname = "guest-agent"; 7 version = "20230510.00"; 8 9 src = fetchFromGitHub { 10 owner = "GoogleCloudPlatform"; 11 repo = pname; 12 rev = version; 13 sha256 = "sha256-gYmmQzSFP/Ik4m+iYHJZyUyZil9+IXWZ3p0Pl58Uq40="; 14 }; 15 16 vendorHash = "sha256-ULGpgygBVC4SRLhPiUlZgBH93w84WlNbvq3S7cVHLaQ="; 17 18 patches = [ ./disable-etc-mutation.patch ]; 19 20 nativeBuildInputs = [ makeWrapper ]; 21 22 postPatch = '' 23 substitute ${./fix-paths.patch} fix-paths.patch \ 24 --subst-var out \ 25 --subst-var-by true "${coreutils}/bin/true" 26 patch -p1 < ./fix-paths.patch 27 ''; 28 29 # We don't add `shadow` here; it's added to PATH if `mutableUsers` is enabled. 30 binPath = lib.makeBinPath [ google-guest-configs google-guest-oslogin iproute2 dhcp procps ]; 31 32 # Skip tests which require networking. 33 preCheck = '' 34 rm google_guest_agent/wsfc_test.go 35 ''; 36 37 postInstall = '' 38 mkdir -p $out/etc/systemd/system 39 cp *.service $out/etc/systemd/system 40 install -Dm644 instance_configs.cfg $out/etc/default/instance_configs.cfg 41 42 wrapProgram $out/bin/google_guest_agent \ 43 --prefix PATH ":" "$binPath" 44 ''; 45 46 meta = with lib; { 47 homepage = "https://github.com/GoogleCloudPlatform/guest-agent"; 48 description = "Guest Agent for Google Compute Engine"; 49 license = licenses.asl20; 50 platforms = platforms.linux; 51 maintainers = with maintainers; [ abbradar ]; 52 }; 53}