Merge pull request #319211 from Gerg-L/devcontaienr

devcontainer: 0.60.0 -> 0.64.0 and fix build
This commit is contained in:
Weijia Wang 2024-06-14 22:49:48 +02:00 committed by GitHub
commit 03128c64ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,40 +1,46 @@
{ lib
, stdenv
, fetchYarnDeps
, fetchFromGitHub
, fixup-yarn-lock
, nodejs
, python3
, makeWrapper
, git
, docker
, yarn
, docker-compose
{
lib,
stdenv,
fetchYarnDeps,
fetchFromGitHub,
fixup-yarn-lock,
nodejs,
python3,
makeBinaryWrapper,
git,
docker,
yarn,
docker-compose,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "devcontainer";
version = "0.60.0";
version = "0.64.0";
src = fetchFromGitHub {
owner = "devcontainers";
repo = "cli";
rev = "v${finalAttrs.version}";
hash = "sha256-/QznJhw+DYwnj/kdP6f4liJlOFhNQO0y7r4i55bJPug=";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-kO5bRLbHNObDLGURrEgNLK70ml2FVDQioLa8cbBBurk=";
};
yarnOfflineCache = fetchYarnDeps {
yarnLock = finalAttrs.src + "/yarn.lock";
yarnLock = "${finalAttrs.src}/yarn.lock";
hash = "sha256-tN7qAvfYmDz5ZtgZL5+ZZtkuxZxvlS9FM3+dGl+daUQ=";
};
nativeBuildInputs = [ yarn fixup-yarn-lock python3 makeWrapper ];
nativeBuildInputs = [
yarn
fixup-yarn-lock
python3
makeBinaryWrapper
nodejs
];
buildPhase = ''
runHook preBuild
export HOME=$(mktemp -d)
yarn config --offline set yarn-offline-mirror ${finalAttrs.yarnOfflineCache}
# Without this, yarn will try to download the dependencies
fixup-yarn-lock yarn.lock
@ -44,27 +50,39 @@ stdenv.mkDerivation (finalAttrs: {
yarn --offline --frozen-lockfile
yarn --offline --frozen-lockfile compile-prod
mkdir -p $out/bin
mkdir -p $out/libexec
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,libexec}
cp -r dist $out/libexec
cp devcontainer.js $out/libexec/devcontainer.js
cp -r node_modules $out/libexec/node_modules
cp -r $src/scripts $out/libexec/scripts
runHook postBuild
runHook postInstall
'';
postInstall = ''
makeWrapper "${nodejs}/bin/node" "$out/bin/devcontainer" \
makeWrapper "${lib.getExe nodejs}" "$out/bin/devcontainer" \
--add-flags "$out/libexec/devcontainer.js" \
--prefix PATH : ${lib.makeBinPath [ git docker docker-compose ]}
--prefix PATH : ${
lib.makeBinPath [
git
docker
docker-compose
]
}
'';
meta = with lib; {
meta = {
description = "Dev container CLI, run and manage your dev environments via a devcontainer.json";
homepage = "https://containers.dev/";
license = licenses.mit;
maintainers = with maintainers; [ rucadi ];
platforms = platforms.unix;
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ rucadi ];
platforms = lib.platforms.unix;
mainProgram = "devcontainer";
};
})