2023-03-15 16:39:30 +00:00
|
|
|
{ lib
|
2022-11-21 17:40:18 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
2023-03-15 16:39:30 +00:00
|
|
|
, makeWrapper
|
|
|
|
, buildGoModule
|
|
|
|
, fetchYarnDeps
|
|
|
|
, fixup_yarn_lock
|
|
|
|
, pkg-config
|
|
|
|
, nodejs
|
|
|
|
, yarn
|
|
|
|
, nodePackages
|
|
|
|
, python3
|
|
|
|
, terraform
|
2022-11-21 17:40:18 +00:00
|
|
|
}:
|
2023-03-15 16:39:30 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
buildGoModule rec {
|
|
|
|
pname = "coder";
|
2023-02-16 17:41:37 +00:00
|
|
|
version = "0.17.1";
|
2022-11-21 17:40:18 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2023-02-16 17:41:37 +00:00
|
|
|
hash = "sha256-FHBaefwSGZXwn1jdU7zK8WhwjarknvyeUJTlhmk/hPM=";
|
2022-11-21 17:40:18 +00:00
|
|
|
};
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
offlineCache = fetchYarnDeps {
|
|
|
|
yarnLock = src + "/site/yarn.lock";
|
|
|
|
hash = "sha256-nRmEXR9fjDxvpbnT+qpGeM0Cc/qW/kN53sKOXwZiBXY=";
|
|
|
|
};
|
|
|
|
|
|
|
|
vendorHash = "sha256-+AvmJkZCFovE2+5Lg98tUvA7f2kBHUMzhl5IyrEGuy8=";
|
|
|
|
|
2023-03-30 22:05:00 +00:00
|
|
|
tags = [ "embed" ];
|
2022-11-21 17:40:18 +00:00
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X github.com/coder/coder/buildinfo.tag=${version}"
|
|
|
|
];
|
|
|
|
|
2023-03-30 22:05:00 +00:00
|
|
|
subPackages = [ "cmd/..." ];
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
preBuild = ''
|
|
|
|
export HOME=$TEMPDIR
|
2022-11-21 17:40:18 +00:00
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
pushd site
|
|
|
|
yarn config --offline set yarn-offline-mirror ${offlineCache}
|
|
|
|
fixup_yarn_lock yarn.lock
|
|
|
|
|
|
|
|
# node-gyp tries to download always the headers and fails: https://github.com/NixOS/nixpkgs/issues/195404
|
|
|
|
yarn remove --offline jest-canvas-mock canvas
|
|
|
|
|
|
|
|
NODE_ENV=production node node_modules/.bin/vite build
|
|
|
|
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
fixup_yarn_lock
|
|
|
|
installShellFiles
|
|
|
|
makeWrapper
|
|
|
|
nodePackages.node-pre-gyp
|
|
|
|
nodejs
|
|
|
|
pkg-config
|
|
|
|
python3
|
|
|
|
yarn
|
|
|
|
];
|
2022-11-21 17:40:18 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd coder \
|
|
|
|
--bash <($out/bin/coder completion bash) \
|
|
|
|
--fish <($out/bin/coder completion fish) \
|
|
|
|
--zsh <($out/bin/coder completion zsh)
|
2023-03-15 16:39:30 +00:00
|
|
|
|
|
|
|
wrapProgram $out/bin/coder --prefix PATH : ${lib.makeBinPath [ terraform ]}
|
2022-11-21 17:40:18 +00:00
|
|
|
'';
|
|
|
|
|
2023-03-30 22:05:00 +00:00
|
|
|
# integration tests require network access
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
meta = {
|
2022-12-17 10:02:37 +00:00
|
|
|
description = "Provision software development environments via Terraform on Linux, macOS, Windows, X86, ARM, and of course, Kubernetes";
|
2022-11-21 17:40:18 +00:00
|
|
|
homepage = "https://coder.com";
|
2023-03-30 22:05:00 +00:00
|
|
|
license = lib.licenses.agpl3;
|
|
|
|
maintainers = [ lib.maintainers.ghuntley lib.maintainers.urandom ];
|
|
|
|
# Failed to download Chromium 109.0.5414.46
|
|
|
|
broken = true; # At 2023-03-30
|
2022-11-21 17:40:18 +00:00
|
|
|
};
|
|
|
|
}
|