diff --git a/pkgs/by-name/gq/gqlgenc/fix-version.patch b/pkgs/by-name/gq/gqlgenc/fix-version.patch new file mode 100644 index 000000000000..083660c9b2f7 --- /dev/null +++ b/pkgs/by-name/gq/gqlgenc/fix-version.patch @@ -0,0 +1,11 @@ +--- a/main.go ++++ b/main.go +@@ -9,7 +9,7 @@ + "github.com/urfave/cli/v2" + ) + +-const version = "0.31.0" ++var version string + + var versionCmd = &cli.Command{ + Name: "version", diff --git a/pkgs/by-name/gq/gqlgenc/package.nix b/pkgs/by-name/gq/gqlgenc/package.nix index 36b886bd49b4..40977cdcb766 100644 --- a/pkgs/by-name/gq/gqlgenc/package.nix +++ b/pkgs/by-name/gq/gqlgenc/package.nix @@ -2,6 +2,7 @@ buildGoModule, fetchFromGitHub, lib, + versionCheckHook, }: buildGoModule rec { @@ -15,10 +16,27 @@ buildGoModule rec { sha256 = "sha256-AGbE+R3502Igl4/HaN8yvFVJBsKQ6iVff8IEvddJLEo="; }; + patches = [ + ./fix-version.patch + ]; + excludedPackages = [ "example" ]; vendorHash = "sha256-kBv9Kit5KdPB48V/g1OaeB0ABFd1A1I/9F5LaQDWxUE="; + ldflags = [ + "-X" + "main.version=${version}" + ]; + + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgramArg = "version"; + + # FAIL: TestLoadConfig_LoadSchema/correct_schema + # panic: httptest: failed to listen on a port: listen tcp6 [::1]:0: bind: operation not permitted + __darwinAllowLocalNetworking = true; + meta = with lib; { description = "Go tool for building GraphQL client with gqlgen"; mainProgram = "gqlgenc";