summary refs log tree commit diff
path: root/pkgs/servers/sql/cockroachdb/cockroachdb-bin.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/servers/sql/cockroachdb/cockroachdb-bin.nix')
-rw-r--r--pkgs/servers/sql/cockroachdb/cockroachdb-bin.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/pkgs/servers/sql/cockroachdb/cockroachdb-bin.nix b/pkgs/servers/sql/cockroachdb/cockroachdb-bin.nix
new file mode 100644
index 00000000000..88a5accaffd
--- /dev/null
+++ b/pkgs/servers/sql/cockroachdb/cockroachdb-bin.nix
@@ -0,0 +1,42 @@
+{ lib
+, stdenv
+, fetchzip
+, buildFHSEnv
+}:
+
+let
+  version = "23.1.7";
+  name = "cockroachdb";
+
+  # For several reasons building cockroach from source has become
+  # nearly impossible. See https://github.com/NixOS/nixpkgs/pull/152626
+  # Therefore we use the pre-build release binary and wrap it with buildFHSUserEnv to
+  # work on nix.
+  # You can generate the hashes with
+  # nix flake prefetch <url>
+  srcs = {
+    aarch64-linux = fetchzip {
+      url = "https://binaries.cockroachdb.com/cockroach-v${version}.linux-arm64.tgz";
+      hash = "sha256-73qJL3o328NckH6POXv+AUvlAJextb31Vs8NGdc8dwE=";
+    };
+    x86_64-linux = fetchzip {
+      url = "https://binaries.cockroachdb.com/cockroach-v${version}.linux-amd64.tgz";
+      hash = "sha256-FL/zDrl+QstBp54LE9/SbIfSPorneGZSef6dcOQJbSo=";
+    };
+  };
+  src = srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
+
+in
+buildFHSEnv {
+  inherit name;
+
+  runScript = "${src}/cockroach";
+
+  meta = with lib; {
+    homepage = "https://www.cockroachlabs.com";
+    description = "A scalable, survivable, strongly-consistent SQL database";
+    license = licenses.bsl11;
+    platforms = [ "aarch64-linux" "x86_64-linux" ];
+    maintainers = with maintainers; [ rushmorem thoughtpolice neosimsim ];
+  };
+}