at 23.11-beta 2.1 kB view raw
1{ lib 2, fetchFromGitHub 3, installShellFiles 4, makeWrapper 5, buildGoModule 6, fetchYarnDeps 7, fixup_yarn_lock 8, pkg-config 9, nodejs 10, yarn 11, nodePackages 12, python3 13, terraform 14}: 15 16buildGoModule rec { 17 pname = "coder"; 18 version = "0.17.1"; 19 20 src = fetchFromGitHub { 21 owner = pname; 22 repo = pname; 23 rev = "v${version}"; 24 hash = "sha256-FHBaefwSGZXwn1jdU7zK8WhwjarknvyeUJTlhmk/hPM="; 25 }; 26 27 offlineCache = fetchYarnDeps { 28 yarnLock = src + "/site/yarn.lock"; 29 hash = "sha256-nRmEXR9fjDxvpbnT+qpGeM0Cc/qW/kN53sKOXwZiBXY="; 30 }; 31 32 vendorHash = "sha256-+AvmJkZCFovE2+5Lg98tUvA7f2kBHUMzhl5IyrEGuy8="; 33 34 tags = [ "embed" ]; 35 36 ldflags = [ 37 "-s" 38 "-w" 39 "-X github.com/coder/coder/buildinfo.tag=${version}" 40 ]; 41 42 subPackages = [ "cmd/..." ]; 43 44 preBuild = '' 45 export HOME=$TEMPDIR 46 47 pushd site 48 yarn config --offline set yarn-offline-mirror ${offlineCache} 49 fixup_yarn_lock yarn.lock 50 51 # node-gyp tries to download always the headers and fails: https://github.com/NixOS/nixpkgs/issues/195404 52 # playwright tries to download Chrome and fails 53 yarn remove --offline jest-canvas-mock canvas @playwright/test playwright 54 55 export PATH=$PATH:$(pwd)/node_modules/.bin 56 NODE_ENV=production node node_modules/.bin/vite build 57 58 popd 59 ''; 60 61 nativeBuildInputs = [ 62 fixup_yarn_lock 63 installShellFiles 64 makeWrapper 65 nodePackages.node-pre-gyp 66 nodejs 67 pkg-config 68 python3 69 yarn 70 ]; 71 72 postInstall = '' 73 installShellCompletion --cmd coder \ 74 --bash <($out/bin/coder completion bash) \ 75 --fish <($out/bin/coder completion fish) \ 76 --zsh <($out/bin/coder completion zsh) 77 78 wrapProgram $out/bin/coder --prefix PATH : ${lib.makeBinPath [ terraform ]} 79 ''; 80 81 # integration tests require network access 82 doCheck = false; 83 84 meta = { 85 description = "Provision software development environments via Terraform on Linux, macOS, Windows, X86, ARM, and of course, Kubernetes"; 86 homepage = "https://coder.com"; 87 license = lib.licenses.agpl3; 88 maintainers = [ lib.maintainers.ghuntley lib.maintainers.urandom ]; 89 }; 90}