Skip to content

Commit

Permalink
[devbox] Speed up yarn install, unset GOROOT. (gravitational#27664)
Browse files Browse the repository at this point in the history
* Speed up yarn install, set GOROOT to nix go.

Yarn is now being installed via yarn's generic install script, which seems
to be much faster than the corresponding nix package. Additionally, the GOROOT
environment variable is being properly set to the nix's go installation.

* Unset goroot instead of trying to set it.
  • Loading branch information
mdwn authored Jun 12, 2023
1 parent 0961bcb commit cb49301
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 58 deletions.
24 changes: 24 additions & 0 deletions build.assets/flake/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
nodeProtocTsVersion = "5.0.1";
grpcToolsVersion = "1.12.4";
libpcscliteVersion = "1.9.9-teleport";
yarnVersion = "1.22.19";

# Package aliases to make reusing these packages easier.
# The individual package names here have been determined by using
Expand Down Expand Up @@ -190,6 +191,28 @@
'';
};

# Yarn binary.
yarn = pkgs.stdenv.mkDerivation {
name = "yarn";
dontUnpack = true;
buildInputs = [
pkgs.cacert
pkgs.curl
pkgs.nodejs-16_x
];
buildPhase = ''
mkdir "$out"
export HOME="$out"
export PROFILE="$HOME/.bashrc"
touch "$PROFILE"
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version ${yarnVersion}
cd "$out/.yarn"
mv * ..
cd "$out"
rm -rf .yarn
'';
};

conditional = if pkgs.stdenv.isLinux then pkgs.stdenv.mkDerivation {
name = "conditional";
dontUnpack = true;
Expand All @@ -209,6 +232,7 @@
libpcsclite = libpcsclite;
protoc-gen-gogo = protoc-gen-gogo;
rust = rust;
yarn = yarn;
};
});
}
9 changes: 6 additions & 3 deletions devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"path:build.assets/flake#conditional",
"path:build.assets/flake#helm",
"path:build.assets/flake#golangci-lint",
"path:build.assets/flake#grpc-tools",
"path:build.assets/flake#libpcsclite",
"path:build.assets/flake#protoc-gen-gogo",
"path:build.assets/flake#rust"
"path:build.assets/flake#rust",
"path:build.assets/flake#yarn"
],
"shell": {
"init_hook": "export TELEPORT_DEVBOX=1"
"init_hook": [
"export TELEPORT_DEVBOX=1",
"unset GOROOT"
]
},
"nixpkgs": {
"commit": "f91ee3065de91a3531329a674a45ddcb3467a650"
Expand Down
55 changes: 0 additions & 55 deletions devbox.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@
"bash": {
"resolved": "github:NixOS/nixpkgs/f91ee3065de91a3531329a674a45ddcb3467a650#bash"
},
"[email protected]": {
"last_modified": "2023-05-01T16:53:22Z",
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#bash",
"version": "5.2-p15"
},
"bash_5": {
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#bash_5"
},
"[email protected]": {
"last_modified": "2021-09-01T12:51:06Z",
"resolved": "github:NixOS/nixpkgs/6cc260cfd60f094500b79e279069b499806bf6d8#bats",
Expand All @@ -27,11 +19,6 @@
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#clang",
"version": "11.1.0"
},
"[email protected]": {
"last_modified": "2023-05-01T16:53:22Z",
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#gcc12",
"version": "12.2.0"
},
"[email protected]": {
"last_modified": "2023-02-28T22:11:13Z",
"resolved": "github:NixOS/nixpkgs/995edc972ad3a1e291ac22d74b9610821357175f#gci",
Expand All @@ -40,29 +27,6 @@
"git": {
"resolved": "github:NixOS/nixpkgs/f91ee3065de91a3531329a674a45ddcb3467a650#git"
},
"[email protected]": {
"last_modified": "2023-05-01T16:53:22Z",
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#git",
"version": "2.40.1"
},
"[email protected]": {
"last_modified": "2023-05-01T16:53:22Z",
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#go",
"version": "1.20.3"
},
"go_1_20": {
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#go_1_20"
},
"gotestsum@latest": {
"last_modified": "2023-05-01T16:53:22Z",
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#gotestsum",
"version": "1.10.0"
},
"[email protected]": {
"last_modified": "2023-02-28T22:11:13Z",
"resolved": "github:NixOS/nixpkgs/995edc972ad3a1e291ac22d74b9610821357175f#kubernetes-helm",
"version": "3.11.1"
},
"[email protected]": {
"last_modified": "2023-05-01T16:53:22Z",
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#libfido2",
Expand All @@ -73,9 +37,6 @@
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#libiconvReal",
"version": "1.16"
},
"nodejs": {
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#nodejs"
},
"[email protected]": {
"last_modified": "2023-01-02T04:31:48Z",
"resolved": "github:NixOS/nixpkgs/a4379d2b0deefedc8dba360897557707ea9ee9a7#nodejs-16_x",
Expand All @@ -86,28 +47,17 @@
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#patchelf",
"version": "0.15.0"
},
"path:build.assets/flake": {},
"path:build.assets/flake#helm": {},
"[email protected]": {
"last_modified": "2023-05-01T16:53:22Z",
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#protobuf3_20",
"version": "3.20.3"
},
"[email protected]": {
"last_modified": "2023-02-28T22:11:13Z",
"resolved": "github:NixOS/nixpkgs/995edc972ad3a1e291ac22d74b9610821357175f#protoc-gen-go",
"version": "1.28.1"
},
"[email protected]": {
"last_modified": "2023-03-31T22:52:29Z",
"plugin_version": "0.0.1",
"resolved": "github:NixOS/nixpkgs/242246ee1e58f54d2322227fc5eef53b4a616a31#python311",
"version": "3.11.2"
},
"rustup": {
"plugin_version": "0.0.1",
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#rustup"
},
"[email protected]": {
"last_modified": "2023-05-01T16:53:22Z",
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#shellcheck",
Expand All @@ -117,11 +67,6 @@
"last_modified": "2023-02-28T22:11:13Z",
"resolved": "github:NixOS/nixpkgs/995edc972ad3a1e291ac22d74b9610821357175f#yamllint",
"version": "1.28.0"
},
"[email protected]": {
"last_modified": "2023-05-01T16:53:22Z",
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#yarn",
"version": "1.22.19"
}
}
}

0 comments on commit cb49301

Please sign in to comment.