nixpkgs/pkgs/by-name/co/cockroachdb/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

52 lines
1.5 KiB
Nix

{ lib
, stdenv
, fetchzip
, buildFHSEnv
}:
let
version = "23.1.14";
pname = "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-cwczzmSKKQs/DN6WZ/FF6nJC82Pu47akeDqWdBMgdz0=";
};
x86_64-linux = fetchzip {
url = "https://binaries.cockroachdb.com/cockroach-v${version}.linux-amd64.tgz";
hash = "sha256-goCBE+zv9KArdoMsI48rlISurUM0bL/l1OEYWQKqzv0=";
};
};
src = srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
in
buildFHSEnv {
inherit pname version;
runScript = "${src}/cockroach";
extraInstallCommands = ''
cp -P $out/bin/cockroachdb $out/bin/cockroach
'';
meta = with lib; {
homepage = "https://www.cockroachlabs.com";
description = "Scalable, survivable, strongly-consistent SQL database";
license = with licenses; [
bsl11
mit
cockroachdb-community-license
];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
platforms = [ "aarch64-linux" "x86_64-linux" ];
maintainers = with maintainers; [ rushmorem thoughtpolice ];
};
}