diff --git a/pkgs/applications/networking/cluster/ssm-agent/default.nix b/pkgs/applications/networking/cluster/ssm-agent/default.nix index a073c9b6fd84..613bac4c9ea6 100644 --- a/pkgs/applications/networking/cluster/ssm-agent/default.nix +++ b/pkgs/applications/networking/cluster/ssm-agent/default.nix @@ -5,9 +5,14 @@ , fetchFromGitHub , coreutils , nettools -, dmidecode +, busybox , util-linux +, stdenv +, dmidecode , bashInteractive +, nix-update-script +, testers +, ssm-agent , overrideEtc ? true }: @@ -27,17 +32,17 @@ let in buildGoPackage rec { pname = "amazon-ssm-agent"; - version = "3.2.1478.0"; + version = "3.2.1630.0"; goPackagePath = "github.com/aws/${pname}"; nativeBuildInputs = [ makeWrapper ]; src = fetchFromGitHub { - rev = version; + rev = "refs/tags/${version}"; owner = "aws"; repo = "amazon-ssm-agent"; - hash = "sha256-SS0N3Wcksk2vq52K6GYE9z4hrckXGqiuCuYPHkH4SWc="; + hash = "sha256-0tN0rBfz2VZ4UkYLFDGg9218O9vyyRT2Lrppu9TETao="; }; patches = [ @@ -49,7 +54,7 @@ buildGoPackage rec { ./0002-version-gen-don-t-use-unnecessary-constants.patch ]; - # See the list https://github.com/aws/amazon-ssm-agent/blob/3.2.1478.0/makefile#L120-L138 + # See the list https://github.com/aws/amazon-ssm-agent/blob/3.2.1630.0/makefile#L120-L138 # The updater is not built because it cannot work on NixOS subPackages = [ "core" @@ -65,24 +70,27 @@ buildGoPackage rec { "-w" ]; - preConfigure = '' + postPatch = '' printf "#!/bin/sh\ntrue" > ./Tools/src/checkstyle.sh substituteInPlace agent/platform/platform_unix.go \ - --replace "/usr/bin/uname" "${coreutils}/bin/uname" \ - --replace '"/bin", "hostname"' '"${nettools}/bin/hostname"' \ - --replace '"lsb_release"' '"${fake-lsb-release}/bin/lsb_release"' - - substituteInPlace agent/managedInstances/fingerprint/hardwareInfo_unix.go \ - --replace /usr/sbin/dmidecode ${dmidecode}/bin/dmidecode + --replace "/usr/bin/uname" "${coreutils}/bin/uname" \ + --replace '"/bin", "hostname"' '"${nettools}/bin/hostname"' \ + --replace '"lsb_release"' '"${fake-lsb-release}/bin/lsb_release"' substituteInPlace agent/session/shell/shell_unix.go \ - --replace '"script"' '"${util-linux}/bin/script"' + --replace '"script"' '"${util-linux}/bin/script"' + + substituteInPlace agent/rebooter/rebooter_unix.go \ + --replace "/sbin/shutdown" "shutdown" echo "${version}" > VERSION '' + lib.optionalString overrideEtc '' substituteInPlace agent/appconfig/constants_unix.go \ --replace '"/etc/amazon/ssm/"' '"${placeholder "out"}/etc/amazon/ssm/"' + '' + lib.optionalString stdenv.isLinux '' + substituteInPlace agent/managedInstances/fingerprint/hardwareInfo_unix.go \ + --replace /usr/sbin/dmidecode ${dmidecode}/bin/dmidecode ''; preBuild = '' @@ -129,11 +137,23 @@ buildGoPackage rec { wrapProgram $out/bin/amazon-ssm-agent --prefix PATH : ${bashInteractive}/bin ''; + passthru = { + updateScript = nix-update-script { }; + tests.version = testers.testVersion { + package = ssm-agent; + command = "amazon-ssm-agent --version"; + }; + }; + meta = with lib; { description = "Agent to enable remote management of your Amazon EC2 instance configuration"; + changelog = "https://github.com/aws/amazon-ssm-agent/releases/tag/${version}"; homepage = "https://github.com/aws/amazon-ssm-agent"; license = licenses.asl20; platforms = platforms.unix; - maintainers = with maintainers; [ copumpkin manveru ]; + maintainers = with maintainers; [ copumpkin manveru anthonyroussel ]; + + # Darwin support is broken + broken = stdenv.isDarwin; }; }