3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/networking/cluster/ssm-agent/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

64 lines
2 KiB
Nix

{ lib, stdenv, fetchFromGitHub, buildGoPackage, bash, makeWrapper }:
buildGoPackage rec {
pname = "amazon-ssm-agent";
version = "2.3.1319.0";
goPackagePath = "github.com/aws/${pname}";
subPackages = [
"agent"
"agent/framework/processor/executer/outofproc/worker"
"agent/framework/processor/executer/outofproc/worker"
"agent/framework/processor/executer/outofproc/sessionworker"
"agent/session/logging"
"agent/cli-main"
];
buildInputs = [ makeWrapper ];
src = fetchFromGitHub {
rev = version;
owner = "aws";
repo = pname;
sha256 = "1yiyhj7ckqa32b1rnbwn7zx89rsj00m5imn1xlpsw002ywxsxbnv";
};
preBuild = ''
mv go/src/${goPackagePath}/vendor strange-vendor
mv strange-vendor/src go/src/${goPackagePath}/vendor
cd go/src/${goPackagePath}
echo ${version} > VERSION
substituteInPlace agent/plugins/inventory/gatherers/application/dataProvider.go \
--replace '"github.com/aws/amazon-ssm-agent/agent/plugins/configurepackage/localpackages"' ""
go run agent/version/versiongenerator/version-gen.go
substituteInPlace agent/appconfig/constants_unix.go \
--replace /usr/bin/ssm-document-worker $bin/bin/ssm-document-worker \
--replace /usr/bin/ssm-session-worker $bin/bin/ssm-session-worker \
--replace /usr/bin/ssm-session-logger $bin/bin/ssm-session-logger
cd -
'';
postBuild = ''
mv go/bin/agent go/bin/amazon-ssm-agent
mv go/bin/worker go/bin/ssm-document-worker
mv go/bin/sessionworker go/bin/ssm-session-worker
mv go/bin/logging go/bin/ssm-session-logger
mv go/bin/cli-main go/bin/ssm-cli
'';
postInstall = ''
wrapProgram $out/bin/amazon-ssm-agent --prefix PATH : ${bash}/bin
'';
meta = with lib; {
description = "Agent to enable remote management of your Amazon EC2 instance configuration";
homepage = "https://github.com/aws/amazon-ssm-agent";
license = licenses.asl20;
platforms = platforms.unix;
maintainers = with maintainers; [ copumpkin manveru ];
};
}