nomad: refactor

This commit is contained in:
zowoq 2022-11-24 18:07:09 +10:00
parent e09752334c
commit 9063accddd
6 changed files with 76 additions and 85 deletions

View File

@ -1,10 +0,0 @@
{ callPackage
, buildGoModule
}:
callPackage ./generic.nix {
inherit buildGoModule;
version = "1.2.15";
sha256 = "sha256-p9yRjSapQAhuHv+slUmYI25bUb1N1A7LBiJOdk1++iI=";
vendorSha256 = "sha256-6d3tE337zVAIkzQzAnV2Ya5xwwhuzmKgtPUJcJ9HRto=";
}

View File

@ -1,10 +0,0 @@
{ callPackage
, buildGoModule
}:
callPackage ./generic.nix {
inherit buildGoModule;
version = "1.3.8";
sha256 = "sha256-hUmDWgGV8HAXew8SpcbhaiaF9VfBN5mk1W7t5lhnZ9I=";
vendorSha256 = "sha256-IfYobyDFriOldJnNfRK0QVKBfttoZZ1iOkt4cBQxd00=";
}

View File

@ -1,10 +0,0 @@
{ callPackage
, buildGoModule
}:
callPackage ./generic.nix {
inherit buildGoModule;
version = "1.4.3";
sha256 = "sha256-GQVfrn9VlzfdIj73W3hBpHcevsXZcb6Uj808HUCZUUg=";
vendorSha256 = "sha256-JQRpsQhq5r/QcgFwtnptmvnjBEhdCFrXFrTKkJioL3A=";
}

View File

@ -0,0 +1,70 @@
{ lib
, buildGoModule
, buildGo119Module
, fetchFromGitHub
, nixosTests
}:
let
generic =
{ buildGoModule, version, sha256, vendorSha256, ... }@attrs:
let attrs' = builtins.removeAttrs attrs [ "buildGoModule" "version" "sha256" "vendorSha256" ];
in
buildGoModule (rec {
pname = "nomad";
inherit version vendorSha256;
subPackages = [ "." ];
src = fetchFromGitHub {
owner = "hashicorp";
repo = pname;
rev = "v${version}";
inherit sha256;
};
# 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" ];
meta = with lib; {
homepage = "https://www.nomadproject.io/";
description = "A Distributed, Highly Available, Datacenter-Aware Scheduler";
platforms = platforms.unix;
license = licenses.mpl20;
maintainers = with maintainers; [ rushmorem pradeepchhetri endocrimes maxeaubrey 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_4;
nomad_1_2 = generic {
buildGoModule = buildGo119Module;
version = "1.2.15";
sha256 = "sha256-p9yRjSapQAhuHv+slUmYI25bUb1N1A7LBiJOdk1++iI=";
vendorSha256 = "sha256-6d3tE337zVAIkzQzAnV2Ya5xwwhuzmKgtPUJcJ9HRto=";
};
nomad_1_3 = generic {
buildGoModule = buildGo119Module;
version = "1.3.8";
sha256 = "sha256-hUmDWgGV8HAXew8SpcbhaiaF9VfBN5mk1W7t5lhnZ9I=";
vendorSha256 = "sha256-IfYobyDFriOldJnNfRK0QVKBfttoZZ1iOkt4cBQxd00=";
};
nomad_1_4 = generic {
buildGoModule = buildGo119Module;
version = "1.4.3";
sha256 = "sha256-GQVfrn9VlzfdIj73W3hBpHcevsXZcb6Uj808HUCZUUg=";
vendorSha256 = "sha256-JQRpsQhq5r/QcgFwtnptmvnjBEhdCFrXFrTKkJioL3A=";
passthru.tests.nomad = nixosTests.nomad;
};
}

View File

@ -1,39 +0,0 @@
{ lib
, buildGoModule
, fetchFromGitHub
, version
, sha256
, vendorSha256
, nixosTests
}:
buildGoModule rec {
pname = "nomad";
inherit version;
subPackages = [ "." ];
src = fetchFromGitHub {
owner = "hashicorp";
repo = pname;
rev = "v${version}";
inherit sha256;
};
inherit vendorSha256;
# 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" ];
passthru.tests.nomad = nixosTests.nomad;
meta = with lib; {
homepage = "https://www.nomadproject.io/";
description = "A Distributed, Highly Available, Datacenter-Aware Scheduler";
platforms = platforms.unix;
license = licenses.mpl20;
maintainers = with maintainers; [ rushmorem pradeepchhetri endocrimes maxeaubrey techknowlogick ];
};
}

View File

@ -9790,22 +9790,12 @@ with pkgs;
noip = callPackage ../tools/networking/noip { };
nomad = nomad_1_4;
# 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_1_2 = callPackage ../applications/networking/cluster/nomad/1.2.nix {
buildGoModule = buildGo119Module;
};
nomad_1_3 = callPackage ../applications/networking/cluster/nomad/1.3.nix {
buildGoModule = buildGo119Module;
};
nomad_1_4 = callPackage ../applications/networking/cluster/nomad/1.4.nix {
buildGoModule = buildGo119Module;
};
inherit (callPackage ../applications/networking/cluster/nomad { })
nomad
nomad_1_2
nomad_1_3
nomad_1_4
;
nomad-autoscaler = callPackage ../applications/networking/cluster/nomad-autoscaler { };