-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
amazon-ec2-metadata-mock: init at 1.12.0 #365690
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,44 @@ | ||||||
{ | ||||||
lib, | ||||||
buildGoModule, | ||||||
fetchFromGitHub, | ||||||
nix-update-script, | ||||||
versionCheckHook, | ||||||
}: | ||||||
|
||||||
buildGoModule rec { | ||||||
pname = "amazon-ec2-metadata-mock"; | ||||||
version = "1.12.0"; | ||||||
|
||||||
src = fetchFromGitHub { | ||||||
owner = "aws"; | ||||||
repo = "amazon-ec2-metadata-mock"; | ||||||
rev = "refs/tags/v${version}"; | ||||||
hash = "sha256-8X6LBGo496fG0Chhvg3jAaUF6mp8psCzHd+Es75z27Y="; | ||||||
}; | ||||||
|
||||||
vendorHash = "sha256-jRJX4hvfRuhR5TlZe7LsXaOlUCwmQGem2QKlX3vuk8c="; | ||||||
|
||||||
subPackages = [ "cmd/" ]; | ||||||
|
||||||
postBuild = '' | ||||||
mv "$GOPATH/bin/cmd" "$GOPATH/bin/$mainProgram" | ||||||
''; | ||||||
Comment on lines
+22
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to enumerate each There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is only one package named There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like it. $ tree /nix/store/r2fcrxh07csw9fs1cld9px13ydvj577m-amazon-ec2-metadata-mock-1.12.0
/nix/store/r2fcrxh07csw9fs1cld9px13ydvj577m-amazon-ec2-metadata-mock-1.12.0
└── bin
└── cmd There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see why we have to do this. The source layout is cursed.
We can only do
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PR to upstream (since this is breaking Go convention): aws/amazon-ec2-metadata-mock#224 Assuming that gets merged, this should be good (with the source hash fixed):
{
lib,
buildGoModule,
fetchFromGitHub,
nix-update-script,
versionCheckHook,
}:
buildGoModule rec {
pname = "amazon-ec2-metadata-mock";
version = "1.12.1";
src = fetchFromGitHub {
owner = "aws";
repo = "amazon-ec2-metadata-mock";
tag = "v${version}";
hash = lib.fakeHash;
};
vendorHash = "sha256-jRJX4hvfRuhR5TlZe7LsXaOlUCwmQGem2QKlX3vuk8c=";
subPackages = [ "cmd/ec2-metadata-mock" ];
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgram = "${builtins.placeholder "out"}/bin/ec2-metadata-mock";
versionCheckProgramArg = "--version";
passthru = {
updateScript = nix-update-script { };
};
meta = {
description = "Tool to simulate Amazon EC2 instance metadata";
homepage = "https://github.com/aws/amazon-ec2-metadata-mock";
license = lib.licenses.asl20;
mainProgram = "ec2-metadata-mock";
maintainers = with lib.maintainers; [ arianvp ];
};
} Edit: Added There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Build output: $ nix-build -A amazon-ec2-metadata-mock
this derivation will be built:
/nix/store/nflp1z2xmcv31bxgwwx99k0qrk5jilv6-amazon-ec2-metadata-mock-1.12.0.drv
building '/nix/store/nflp1z2xmcv31bxgwwx99k0qrk5jilv6-amazon-ec2-metadata-mock-1.12.0.drv'...
Using versionCheckHook
Running phase: unpackPhase
unpacking source archive /nix/store/crycqj02168xghr6npqvjs3kg3xkikgs-source
source root is source
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
Running phase: buildPhase
Building subPackage ./cmd/ec2-metadata-mock
Running phase: checkPhase
? github.com/aws/amazon-ec2-metadata-mock/cmd/ec2-metadata-mock [no test files]
Running phase: installPhase
Running phase: fixupPhase
shrinking RPATHs of ELF executables and libraries in /nix/store/wqmlv0g809zrkb3q4r9ap12lcppkwadf-amazon-ec2-metadata-mock-1.12.0
shrinking /nix/store/wqmlv0g809zrkb3q4r9ap12lcppkwadf-amazon-ec2-metadata-mock-1.12.0/bin/ec2-metadata-mock
checking for references to /build/ in /nix/store/wqmlv0g809zrkb3q4r9ap12lcppkwadf-amazon-ec2-metadata-mock-1.12.0...
patching script interpreter paths in /nix/store/wqmlv0g809zrkb3q4r9ap12lcppkwadf-amazon-ec2-metadata-mock-1.12.0
stripping (with command strip and flags -S -p) in /nix/store/wqmlv0g809zrkb3q4r9ap12lcppkwadf-amazon-ec2-metadata-mock-1.12.0/bin
Running phase: installCheckPhase
Executing versionCheckPhase
Successfully managed to find version 1.12.0 in the output of the command /nix/store/wqmlv0g809zrkb3q4r9ap12lcppkwadf-amazon-ec2-metadata-mock-1.12.0/bin/ec2-metadata-mock --version
2024/12/17 18:25:56 Warning: Failed to find home directory due to error: exec: "getent": executable file not found in $PATH
v1.12.0
Finished versionCheckPhase
no Makefile or custom installCheckPhase, doing nothing
/nix/store/wqmlv0g809zrkb3q4r9ap12lcppkwadf-amazon-ec2-metadata-mock-1.12.0 Looks like there's some pesky dependency on
Seems to be for config file handling. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The They need to migrate off that package since it's archived and they should be using the built-in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Opened an issue upstream for removing the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PR to upstream: aws/amazon-ec2-metadata-mock#226 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like upstream is already reviewing the 2 PRs (they've approved the GitHub Actions workflow runs for them). Might be merged pretty quickly. |
||||||
|
||||||
mainProgram = "ec2-metadata-mock"; | ||||||
doInstallCheck = true; | ||||||
nativeInstallCheckInputs = [ versionCheckHook ]; | ||||||
versionCheckProgram = "${placeholder "out"}/bin/${mainProgram}"; | ||||||
|
||||||
passthru = { | ||||||
updateScript = nix-update-script { }; | ||||||
}; | ||||||
|
||||||
meta = { | ||||||
description = "A tool to simulate Amazon EC2 instance metadata"; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
homepage = "https://github.com/aws/amazon-ec2-metadata-mock"; | ||||||
license = lib.licenses.asl20; | ||||||
inherit mainProgram; | ||||||
maintainers = with lib.maintainers; [ arianvp ]; | ||||||
}; | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tag parameter was recently added to make this shorter.
LGTM otherwise.