summary refs log tree commit diff
path: root/pkgs/tools/misc/turbo
diff options
context:
space:
mode:
authorDane Lipscombe <danelipscombe@gmail.com>2023-02-16 14:27:44 +1100
committerDane Lipscombe <danelipscombe@gmail.com>2023-02-16 14:27:44 +1100
commitd76127f9fef3a9ac265acfc369324c0332890d8f (patch)
tree4bc32782b2d5f359e89a209e5d669bdb63a7937d /pkgs/tools/misc/turbo
parent545c7a31e5dedea4a6d372712a18e00ce097d462 (diff)
downloadnixpkgs-d76127f9fef3a9ac265acfc369324c0332890d8f.tar
nixpkgs-d76127f9fef3a9ac265acfc369324c0332890d8f.tar.gz
nixpkgs-d76127f9fef3a9ac265acfc369324c0332890d8f.tar.bz2
nixpkgs-d76127f9fef3a9ac265acfc369324c0332890d8f.tar.lz
nixpkgs-d76127f9fef3a9ac265acfc369324c0332890d8f.tar.xz
nixpkgs-d76127f9fef3a9ac265acfc369324c0332890d8f.tar.zst
nixpkgs-d76127f9fef3a9ac265acfc369324c0332890d8f.zip
turbo: init at 1.7.0
Diffstat (limited to 'pkgs/tools/misc/turbo')
-rw-r--r--pkgs/tools/misc/turbo/default.nix91
1 files changed, 91 insertions, 0 deletions
diff --git a/pkgs/tools/misc/turbo/default.nix b/pkgs/tools/misc/turbo/default.nix
new file mode 100644
index 00000000000..5aca983252d
--- /dev/null
+++ b/pkgs/tools/misc/turbo/default.nix
@@ -0,0 +1,91 @@
+{ lib
+, fetchFromGitHub
+, buildGoModule
+, git
+, nodejs
+, protobuf
+, protoc-gen-go
+, protoc-gen-go-grpc
+, rustPlatform
+, pkg-config
+, openssl
+, extra-cmake-modules
+, fontconfig
+, go
+}:
+let
+  version = "1.7.0";
+  src = fetchFromGitHub {
+    owner = "vercel";
+    repo = "turbo";
+    rev = "v${version}";
+    sha256 = "YTuEv2S3jNV2o7HJML+P6OMazgwgRhUPnd/zaTWfDWs=";
+  };
+
+  go-turbo = buildGoModule rec {
+    inherit src version;
+    pname = "go-turbo";
+    modRoot = "cli";
+
+    vendorSha256 = "Kx/CLFv23h2TmGe8Jwu+S3QcONfqeHk2fCW1na75c0s=";
+
+    nativeBuildInputs = [
+      git
+      nodejs
+      protobuf
+      protoc-gen-go
+      protoc-gen-go-grpc
+    ];
+
+    preBuild = ''
+      make compile-protos
+    '';
+
+    preCheck = ''
+      # Some tests try to run mkdir $HOME
+      HOME=$TMP
+
+      # Test_getTraversePath requires that source is a git repo
+      # pwd: /build/source/cli
+      pushd ..
+      git config --global init.defaultBranch main
+      git init
+      popd
+    '';
+
+  };
+in
+rustPlatform.buildRustPackage rec {
+  pname = "turbo";
+  inherit src version;
+  cargoBuildFlags = [
+    "--package"
+    "turbo"
+  ];
+  RELEASE_TURBO_CLI = "true";
+
+  cargoSha256 = "ENw6NU3Fedd+OJEEWgL8A54aowNqjn3iv7rxlr+/4ZE=";
+  RUSTC_BOOTSTRAP = 1;
+  nativeBuildInputs = [
+    pkg-config
+    extra-cmake-modules
+  ];
+  buildInputs = [
+    openssl
+    fontconfig
+  ];
+
+  postInstall = ''
+    ln -s ${go-turbo}/bin/turbo $out/bin/go-turbo
+  '';
+
+  # Browser tests time out with chromium and google-chrome
+  doCheck = false;
+
+  meta = with lib; {
+    description = "High-performance build system for JavaScript and TypeScript codebases";
+    homepage = "https://turbo.build/";
+    maintainers = with maintainers; [ dlip ];
+    license = licenses.mpl20;
+  };
+}