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 = [