diff --git a/pkgs/by-name/or/ory-hydra/package.nix b/pkgs/by-name/or/ory-hydra/package.nix index 14ab16c90129..237ec0a80b80 100644 --- a/pkgs/by-name/or/ory-hydra/package.nix +++ b/pkgs/by-name/or/ory-hydra/package.nix @@ -1,8 +1,10 @@ { lib, + stdenv, buildGoModule, fetchFromGitHub, versionCheckHook, + installShellFiles, }: buildGoModule (finalAttrs: { pname = "hydra"; @@ -17,6 +19,7 @@ buildGoModule (finalAttrs: { vendorHash = "sha256-KVCoDATyt5Qp0r3vGwdXqkjh0FEdNyKi6mXk99D6HD8="; + __structuredAttrs = true; # `json1` not needed (see: https://github.com/ory/hydra/commit/93edc9ad894771c67f46ae2c57ee7e50382d73cd) # `sqlite_omit_load_extension` consistency with upstream (see: https://github.com/ory/hydra/blob/master/.docker/Dockerfile-local-build#L20C58-L20C84). Will disable sqlite runtime extension loading (see: https://sqlite.org/loadext.html) tags = [ @@ -25,22 +28,49 @@ buildGoModule (finalAttrs: { "sqlite_omit_load_extension" ]; - subPackages = [ "." ]; + subPackages = [ "..." ]; ldflags = [ "-s" - "-X github.com/ory/hydra/v2/driver/config.Version=v${finalAttrs.version}" + "-X github.com/ory/hydra/v2/driver/config.Version=${finalAttrs.src.tag}" "-X github.com/ory/hydra/v2/driver/config.Commit=${finalAttrs.src.rev}" ]; + nativeBuildInputs = [ installShellFiles ]; + # tests use dynamic port assignment via port `0` + __darwinAllowLocalNetworking = true; + preCheck = '' + export version="${finalAttrs.src.tag}" + ''; + checkFlags = [ + "-short" + ]; doInstallCheck = true; nativeInstallCheckInputs = [ versionCheckHook ]; versionCheckProgramArg = [ "version" ]; + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd hydra \ + --bash <($out/bin/hydra completion bash) \ + --fish <($out/bin/hydra completion fish) \ + --zsh <($out/bin/hydra completion zsh) + ''; + meta = { description = "OpenID Certified™ OAuth 2.0 Server and OpenID Connect Provider"; - homepage = "https://www.ory.com/hydra"; - changelog = "https://github.com/ory/hydra/releases/tag/v${finalAttrs.version}"; + longDescription = '' + Server implementation of the OAuth 2.0 authorization framework and the OpenID Connect Core 1.0. It follows + [cloud architecture best practices](https://www.ory.com/docs/ecosystem/software-architecture-philosophy) and focuses on: + + - OAuth 2.0 and OpenID Connect flows + - Token issuance and validation + - Client management + - Consent and login flow orchestration + - JWKS management + - Low latency and high throughput + ''; + homepage = "https://github.com/ory/hydra"; + changelog = "https://github.com/ory/hydra/releases/tag/${finalAttrs.src.tag}"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ debtquity