Files
nixpkgs/pkgs/by-name/de/devcontainer/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

96 lines
2.1 KiB
Nix

{
lib,
stdenv,
fetchYarnDeps,
fetchFromGitHub,
fixup-yarn-lock,
nodejs_20,
python3,
makeBinaryWrapper,
git,
docker,
yarn,
docker-compose,
nix-update-script,
}:
let
nodejs = nodejs_20; # does not build with 22
in
stdenv.mkDerivation (finalAttrs: {
pname = "devcontainer";
version = "0.80.1";
src = fetchFromGitHub {
owner = "devcontainers";
repo = "cli";
tag = "v${finalAttrs.version}";
hash = "sha256-riDe8j/DCSuXpuFi27tmT5KjruuJiCrUeP022V4sYjU=";
};
yarnOfflineCache = fetchYarnDeps {
yarnLock = "${finalAttrs.src}/yarn.lock";
hash = "sha256-joctNMzQXC/A9A69sJkKbED9pqMcbK1ZYiHPdJBJKCE=";
};
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
]
}
'';
passthru.updateScript = nix-update-script { };
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";
};
})