nixpkgs/pkgs/by-name/de/devcontainer/package.nix
Josh Spicer cf2f7895b7
devcontainer: 0.64.0 -> 0.65.0
Increments the devcontainer CLI from 0.64.0 to 0.65.0.

Changelog: https://github.com/devcontainers/cli/blob/main/CHANGELOG.md#0650

(Awesome jobs, @Rucadi @Gerg-L ! I opened my laptop today to finally resurrect #276208, only to see the work had already been done 🎉 )

_Creating a new pull request as the commit message was incorrect, apologies for that._
2024-06-29 09:15:25 -07:00

89 lines
2.0 KiB
Nix

{
lib,
stdenv,
fetchYarnDeps,
fetchFromGitHub,
fixup-yarn-lock,
nodejs,
python3,
makeBinaryWrapper,
git,
docker,
yarn,
docker-compose,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "devcontainer";
version = "0.65.0";
src = fetchFromGitHub {
owner = "devcontainers";
repo = "cli";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-Q1qQjIRyOeFr8qrZJZ1IkO12RM2hp4IxI1NI7WqpmZA=";
};
yarnOfflineCache = fetchYarnDeps {
yarnLock = "${finalAttrs.src}/yarn.lock";
hash = "sha256-tN7qAvfYmDz5ZtgZL5+ZZtkuxZxvlS9FM3+dGl+daUQ=";
};
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
# set nodedir to prevent node-gyp from downloading headers
export npm_config_nodedir=${nodejs}
yarn --offline --frozen-lockfile
yarn --offline --frozen-lockfile compile-prod
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 postInstall
'';
postInstall = ''
makeWrapper "${lib.getExe nodejs}" "$out/bin/devcontainer" \
--add-flags "$out/libexec/devcontainer.js" \
--prefix PATH : ${
lib.makeBinPath [
git
docker
docker-compose
]
}
'';
meta = {
description = "Dev container CLI, run and manage your dev environments via a devcontainer.json";
homepage = "https://containers.dev/";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ rucadi ];
platforms = lib.platforms.unix;
mainProgram = "devcontainer";
};
})