infra/nix/oracle-gitea-runner/coder.nix

86 lines
2.1 KiB
Nix
Raw Normal View History

2024-02-05 13:13:44 +00:00
{
lib,
fetchurl,
installShellFiles,
makeWrapper,
terraform,
stdenvNoCC,
unzip,
}: let
2023-11-07 12:33:12 +00:00
inherit (stdenvNoCC.hostPlatform) system;
in
2024-02-05 13:13:44 +00:00
stdenvNoCC.mkDerivation rec {
pname = "coder";
version = "2.3.3";
2023-11-07 12:33:12 +00:00
2024-02-05 13:13:44 +00:00
src = fetchurl {
sha256 =
{
x86_64-linux = "sha256-3gO71Eii3KBjn/oQ1Q3OCJ7S6H12iDYjOfqf43ph1nQ=";
x86_64-darwin = lib.fakeHash;
aarch64-linux = "sha256-v7S22I62EKPcHO9yZGciKKftRlzIowfAeVgnccOdlSs=";
aarch64-darwin = "";
}
.${system};
2023-11-07 12:33:12 +00:00
2024-02-05 13:13:44 +00:00
url = let
systemName =
{
x86_64-linux = "linux_amd64";
aarch64-linux = "linux_arm64";
x86_64-darwin = "darwin_amd64";
aarch64-darwin = "darwin_arm64";
}
.${system};
2023-11-07 12:33:12 +00:00
2024-02-05 13:13:44 +00:00
ext =
{
x86_64-linux = "tar.gz";
aarch64-linux = "tar.gz";
x86_64-darwin = "zip";
aarch64-darwin = "zip";
}
.${system};
in "https://github.com/coder/coder/releases/download/v${version}/coder_${version}_${systemName}.${ext}";
};
2023-11-07 12:33:12 +00:00
2024-02-05 13:13:44 +00:00
nativeBuildInputs = [
installShellFiles
makeWrapper
unzip
];
2023-11-07 12:33:12 +00:00
2024-02-05 13:13:44 +00:00
unpackPhase = ''
printf 'Decompressing %s\n' "$src"
case $src in
*.tar.gz) tar -xz -f "$src" ;;
*.zip) unzip "$src" ;;
esac
'';
2023-11-07 12:33:12 +00:00
2024-02-05 13:13:44 +00:00
installPhase = ''
mkdir -p $out/bin
cp coder $out/bin
'';
2023-11-07 12:33:12 +00:00
2024-02-05 13:13:44 +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-11-07 12:33:12 +00:00
2024-02-05 13:13:44 +00:00
wrapProgram $out/bin/coder --prefix PATH : ${lib.makeBinPath [terraform]}
'';
2023-11-07 12:33:12 +00:00
2024-02-05 13:13:44 +00:00
# integration tests require network access
doCheck = false;
2023-11-07 12:33:12 +00:00
2024-02-05 13:13:44 +00:00
meta = {
description = "Provision software development environments via Terraform on Linux, macOS, Windows, X86, ARM, and of course, Kubernetes";
homepage = "https://coder.com";
license = lib.licenses.agpl3;
maintainers = [lib.maintainers.ghuntley lib.maintainers.urandom];
broken = false;
};
}