From a3b6da2980eb48b4d6655643263b6f41b33bff17 Mon Sep 17 00:00:00 2001 From: Ben Mask Date: Fri, 10 Apr 2026 12:24:48 -0400 Subject: [PATCH] Add vitess 21.0.4 package with config/ directory The upstream nixpkgs vitess package only ships bin/, but vttestserver and mysqlctl expect $VTROOT/config/init_db.sql and $VTROOT/config/mycnf/*.cnf at runtime. This package builds vitess from source and includes the config directory in the output. Co-Authored-By: Claude Opus 4.6 (1M context) --- flake.nix | 1 + pkgs/default.nix | 2 ++ pkgs/vitess.nix | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 pkgs/vitess.nix diff --git a/flake.nix b/flake.nix index 0f82671..6c57ae1 100644 --- a/flake.nix +++ b/flake.nix @@ -32,6 +32,7 @@ terragrunt debezium-connector-planetscale debezium-connector-vitess + vitess ; debezium = customPkgs.debezium-connector-mysql; # Alias for compatibility }; diff --git a/pkgs/default.nix b/pkgs/default.nix index 1aecf17..e2123e7 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,4 +1,6 @@ {pkgs}: { + vitess = import ./vitess.nix {inherit pkgs;}; + debezium-connector-mysql = import ./debezium-connector-mysql.nix {inherit pkgs;}; cursor-cli = import ./cursor-cli.nix {inherit pkgs;}; elasticsearch8 = import ./elasticsearch8.nix {inherit pkgs;}; diff --git a/pkgs/vitess.nix b/pkgs/vitess.nix new file mode 100644 index 0000000..77fef70 --- /dev/null +++ b/pkgs/vitess.nix @@ -0,0 +1,37 @@ +# Builds vitess 21.0.4 with the config/ directory included. +# +# The upstream nixpkgs vitess package only ships bin/, but vttestserver/mysqlctl +# expect $VTROOT/config/init_db.sql and $VTROOT/config/mycnf/*.cnf at runtime. +{pkgs}: +pkgs.buildGoModule (finalAttrs: { + pname = "vitess"; + version = "21.0.4"; + + src = pkgs.fetchFromGitHub { + owner = "vitessio"; + repo = "vitess"; + rev = "v${finalAttrs.version}"; + hash = "sha256-QapbbLZ/wDCKYQW98l780PT4ZEXAbhW0o4Zk2MlG6DQ="; + }; + + vendorHash = "sha256-Bc9rhfGSjqhDQBOPS4noW8qJ4P5xLtVcokRhDbqP3a0="; + + buildInputs = [pkgs.sqlite]; + + subPackages = ["go/cmd/..."]; + + doCheck = false; + + postInstall = '' + mkdir -p $out/config/mycnf + cp $src/config/init_db.sql $out/config/ + cp $src/config/mycnf/*.cnf $out/config/mycnf/ + ''; + + meta = { + homepage = "https://vitess.io/"; + changelog = "https://github.com/vitessio/vitess/releases/tag/v${finalAttrs.version}"; + description = "Database clustering system for horizontal scaling of MySQL"; + license = pkgs.lib.licenses.asl20; + }; +})