From 64116848928dde52ef7af9a4c3cd6994b9128bb7 Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Tue, 26 Aug 2025 17:15:44 +0100 Subject: [PATCH] Explicitly set ent-go runtime version --- pkgs/by-name/en/ent-go/ent_version.patch | 28 ++++++++++++++++++++++++ pkgs/by-name/en/ent-go/package.nix | 9 ++++++++ 2 files changed, 37 insertions(+) create mode 100644 pkgs/by-name/en/ent-go/ent_version.patch diff --git a/pkgs/by-name/en/ent-go/ent_version.patch b/pkgs/by-name/en/ent-go/ent_version.patch new file mode 100644 index 000000000000..80a7dc47dffc --- /dev/null +++ b/pkgs/by-name/en/ent-go/ent_version.patch @@ -0,0 +1,28 @@ +--- a/entc/gen/graph.go 2025-08-26 12:42:17.548313631 +0100 ++++ b/entc/gen/graph.go 2025-08-26 12:43:32.398186157 +0100 +@@ -1008,22 +1008,10 @@ + + // ModuleInfo returns the entgo.io/ent version. + func (Config) ModuleInfo() (m debug.Module) { +- const pkg = "entgo.io/ent" +- info, ok := debug.ReadBuildInfo() +- if !ok { +- return +- } +- // Was running as a CLI (ent/cmd/ent). +- if info.Main.Path == pkg { +- return info.Main +- } +- // Or, as a main package (ent/entc). +- for _, dep := range info.Deps { +- if dep.Path == pkg { +- return *dep +- } ++ return debug.Module{ ++ Version: "@version@", ++ Sum: "@sum@", + } +- return + } + + // FeatureEnabled reports if the given feature name is enabled. diff --git a/pkgs/by-name/en/ent-go/package.nix b/pkgs/by-name/en/ent-go/package.nix index 91991af8ec2e..611fc0df5e5d 100644 --- a/pkgs/by-name/en/ent-go/package.nix +++ b/pkgs/by-name/en/ent-go/package.nix @@ -3,6 +3,7 @@ buildGoModule, fetchFromGitHub, installShellFiles, + replaceVars, }: buildGoModule rec { @@ -18,6 +19,14 @@ buildGoModule rec { vendorHash = "sha256-ec5tA9TsDKGnHVZWilLj7bdHrd46uQcNQ8YCK/s6UAY="; + patches = [ + # patch in version information so we don't get "version = "(devel)";" + (replaceVars ./ent_version.patch { + inherit version; + sum = src.outputHash; + }) + ]; + subPackages = [ "cmd/ent" ]; ldflags = [