diff --git a/pkgs/applications/networking/cluster/nomad/1.2.nix b/pkgs/applications/networking/cluster/nomad/1.2.nix deleted file mode 100644 index e53854e95d23..000000000000 --- a/pkgs/applications/networking/cluster/nomad/1.2.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ callPackage -, buildGoModule -}: - -callPackage ./generic.nix { - inherit buildGoModule; - version = "1.2.15"; - sha256 = "sha256-p9yRjSapQAhuHv+slUmYI25bUb1N1A7LBiJOdk1++iI="; - vendorSha256 = "sha256-6d3tE337zVAIkzQzAnV2Ya5xwwhuzmKgtPUJcJ9HRto="; -} diff --git a/pkgs/applications/networking/cluster/nomad/1.3.nix b/pkgs/applications/networking/cluster/nomad/1.3.nix deleted file mode 100644 index 65b28b51d25f..000000000000 --- a/pkgs/applications/networking/cluster/nomad/1.3.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ callPackage -, buildGoModule -}: - -callPackage ./generic.nix { - inherit buildGoModule; - version = "1.3.8"; - sha256 = "sha256-hUmDWgGV8HAXew8SpcbhaiaF9VfBN5mk1W7t5lhnZ9I="; - vendorSha256 = "sha256-IfYobyDFriOldJnNfRK0QVKBfttoZZ1iOkt4cBQxd00="; -} diff --git a/pkgs/applications/networking/cluster/nomad/1.4.nix b/pkgs/applications/networking/cluster/nomad/1.4.nix deleted file mode 100644 index aa8ef963d8dd..000000000000 --- a/pkgs/applications/networking/cluster/nomad/1.4.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ callPackage -, buildGoModule -}: - -callPackage ./generic.nix { - inherit buildGoModule; - version = "1.4.3"; - sha256 = "sha256-GQVfrn9VlzfdIj73W3hBpHcevsXZcb6Uj808HUCZUUg="; - vendorSha256 = "sha256-JQRpsQhq5r/QcgFwtnptmvnjBEhdCFrXFrTKkJioL3A="; -} diff --git a/pkgs/applications/networking/cluster/nomad/default.nix b/pkgs/applications/networking/cluster/nomad/default.nix new file mode 100644 index 000000000000..faec09480774 --- /dev/null +++ b/pkgs/applications/networking/cluster/nomad/default.nix @@ -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; + }; +} diff --git a/pkgs/applications/networking/cluster/nomad/generic.nix b/pkgs/applications/networking/cluster/nomad/generic.nix deleted file mode 100644 index c5d92eaf1f7e..000000000000 --- a/pkgs/applications/networking/cluster/nomad/generic.nix +++ /dev/null @@ -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 ]; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dd2356a81471..5e0e798be20b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };