patching is da wae

This commit is contained in:
Jakub Kropáček 2024-11-14 20:05:28 +01:00
parent 0a5d5f29f9
commit c12182484a
2 changed files with 30 additions and 1 deletions

22
nix/migrate-version.patch Normal file
View file

@ -0,0 +1,22 @@
diff --git a/sql-migrate/config.go b/sql-migrate/config.go
index 6947a53..df394d8 100644
--- a/sql-migrate/config.go
+++ b/sql-migrate/config.go
@@ -6,7 +6,6 @@ import (
"flag"
"fmt"
"os"
- "runtime/debug"
"github.com/go-gorp/gorp/v3"
"gopkg.in/yaml.v2"
@@ -112,8 +111,5 @@ func GetConnection(env *Environment) (*sql.DB, string, error) {
// GetVersion returns the version.
func GetVersion() string {
- if buildInfo, ok := debug.ReadBuildInfo(); ok && buildInfo.Main.Version != "(devel)" {
- return buildInfo.Main.Version
- }
- return "dev"
+ return "@current_version@"
}

View file

@ -2,6 +2,7 @@
, lib
, buildGoModule
, fetchFromGitHub
, substituteAll
}:
buildGoModule rec {
@ -20,7 +21,13 @@ buildGoModule rec {
ldflags = [
"-s"
"-w"
"-X Main.Version=v${version}"
];
patches = [
(substituteAll {
src = ./migrate-version.patch;
current_version = "v${version}";
})
];
doCheck = false;