ory-hydra: run upstream test suite

* add `subPackages` attr to build and test relevant artifacts, remove
  custom `checkPhase`
* add __darwinAllowLocalNetworking, __structuredAttrs
* update comment (https://github.com/NixOS/nixpkgs/pull/502029#discussion_r3016666366)
* use `finalAttrs.src.tag` (https://github.com/NixOS/nixpkgs/pull/502029#discussion_r3016668229)
* remove `-failfast` switch (https://github.com/NixOS/nixpkgs/pull/502029#discussion_r3016669901)
* fix tests by adding `export GOFLAGS=''${GOFLAGS//-trimpath/}`
* add `postInstall` to install shell completion, update meta attrs
This commit is contained in:
Darren Rambaud
2026-06-28 16:55:23 -05:00
parent f4d3f22c84
commit 4e1d75500f
+34 -4
View File
@@ -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