nixpkgs/pkgs/applications/networking/cluster/nomad/default.nix
Fabián Heredia Montiel ff323ed355 treewide: vendorSha256 → vendorHash
via: `find pkgs/ -type f -exec sed -i 's/vendorSha256 = "sha256/vendorHash = "sha256/' {};`
2023-09-13 01:03:44 -06:00

86 lines
2.5 KiB
Nix

{ lib
, buildGoModule
, buildGo120Module
, fetchFromGitHub
, nixosTests
, installShellFiles
}:
let
generic =
{ buildGoModule, version, sha256, vendorHash, ... }@attrs:
let attrs' = builtins.removeAttrs attrs [ "buildGoModule" "version" "sha256" "vendorHash" ];
in
buildGoModule (rec {
pname = "nomad";
inherit version vendorHash;
subPackages = [ "." ];
src = fetchFromGitHub {
owner = "hashicorp";
repo = pname;
rev = "v${version}";
inherit sha256;
};
nativeBuildInputs = [ installShellFiles ];
# ui:
# Nomad release commits include the compiled version of the UI, but the file
# is only included if we build with the ui tag.
tags = [ "ui" ];
postInstall = ''
echo "complete -C $out/bin/nomad nomad" > nomad.bash
installShellCompletion nomad.bash
'';
meta = with lib; {
homepage = "https://www.nomadproject.io/";
description = "A Distributed, Highly Available, Datacenter-Aware Scheduler";
license = licenses.mpl20;
maintainers = with maintainers; [ rushmorem pradeepchhetri endocrimes amaxine techknowlogick ];
};
} // attrs');
in
rec {
# Nomad never updates major go versions within a release series and is unsupported
# on Go versions that it did not ship with. Due to historic bugs when compiled
# with different versions we pin Go for all versions.
# Upstream partially documents used Go versions here
# https://github.com/hashicorp/nomad/blob/master/contributing/golang.md
nomad = nomad_1_5;
nomad_1_4 = generic {
buildGoModule = buildGo120Module;
version = "1.4.12";
sha256 = "sha256-dO98FOaO5MB5pWzeF705s/aBDTaF0OyWnVxWGB91suI=";
vendorHash = "sha256-D5TcTZa64Jr47u4mrTXK4lUIC5gfBQNVgL6QKh1CaQM=";
passthru.tests.nomad = nixosTests.nomad;
};
nomad_1_5 = generic {
buildGoModule = buildGo120Module;
version = "1.5.8";
sha256 = "sha256-5VAUNunQz4s1Icd+s5i8Kx6u1P0By+ikl4C5wXM1oho=";
vendorHash = "sha256-y3WiQuoQn6SdwTgtPWuB6EBtsJC+YleQPzownZQNkno=";
passthru.tests.nomad = nixosTests.nomad;
preCheck = ''
export PATH="$PATH:$NIX_BUILD_TOP/go/bin"
'';
};
nomad_1_6 = generic {
buildGoModule = buildGo120Module;
version = "1.6.1";
sha256 = "sha256-RsyGUaLteGiNf0PTkKLcjHTevhKb/mNx2JORpXhHJMw=";
vendorHash = "sha256-Y3O7ADzZPlLWFbXSYBcI6b5MAhMD0UnkhQxO9VJMpOY=";
passthru.tests.nomad = nixosTests.nomad;
preCheck = ''
export PATH="$PATH:$NIX_BUILD_TOP/go/bin"
'';
};
}