diff --git a/pkgs/applications/networking/cluster/kops/default.nix b/pkgs/applications/networking/cluster/kops/default.nix index 96f3354023cf..cd6cd9ee22b2 100644 --- a/pkgs/applications/networking/cluster/kops/default.nix +++ b/pkgs/applications/networking/cluster/kops/default.nix @@ -1,44 +1,57 @@ -{ stdenv, buildGoPackage, fetchFromGitHub, go-bindata }: - -buildGoPackage rec { - name = "kops-${version}"; - version = "1.12.1"; +{ stdenv, lib, buildGoPackage, fetchFromGitHub, go-bindata }: +let goPackagePath = "k8s.io/kops"; - src = fetchFromGitHub { - rev = version; - owner = "kubernetes"; - repo = "kops"; - sha256 = "09rmgazdrmnh1lqaayzfbn0ld7mbj9whihs9ijv5gf6si9p0ml9y"; - }; + generic = { version, sha256, ...}@attrs: + let attrs' = builtins.removeAttrs attrs ["version" "sha256"] ; in + buildGoPackage { + name = "kops-${version}"; - buildInputs = [go-bindata]; - subPackages = ["cmd/kops"]; + inherit goPackagePath; - buildFlagsArray = '' - -ldflags= - -X k8s.io/kops.Version=${version} - -X k8s.io/kops.GitVersion=${version} - ''; + src = fetchFromGitHub { + rev = version; + owner = "kubernetes"; + repo = "kops"; + inherit sha256; + }; - preBuild = '' - (cd go/src/k8s.io/kops - go-bindata -o upup/models/bindata.go -pkg models -prefix upup/models/ upup/models/...) - ''; + buildInputs = [go-bindata]; + subPackages = ["cmd/kops"]; - postInstall = '' - mkdir -p $bin/share/bash-completion/completions - mkdir -p $bin/share/zsh/site-functions - $bin/bin/kops completion bash > $bin/share/bash-completion/completions/kops - $bin/bin/kops completion zsh > $bin/share/zsh/site-functions/_kops - ''; + buildFlagsArray = '' + -ldflags= + -X k8s.io/kops.Version=${version} + -X k8s.io/kops.GitVersion=${version} + ''; - meta = with stdenv.lib; { - description = "Easiest way to get a production Kubernetes up and running"; - homepage = https://github.com/kubernetes/kops; - license = licenses.asl20; - maintainers = with maintainers; [offline zimbatm]; - platforms = platforms.unix; + preBuild = '' + (cd go/src/k8s.io/kops + go-bindata -o upup/models/bindata.go -pkg models -prefix upup/models/ upup/models/...) + ''; + + postInstall = '' + mkdir -p $bin/share/bash-completion/completions + mkdir -p $bin/share/zsh/site-functions + $bin/bin/kops completion bash > $bin/share/bash-completion/completions/kops + $bin/bin/kops completion zsh > $bin/share/zsh/site-functions/_kops + ''; + + meta = with stdenv.lib; { + description = "Easiest way to get a production Kubernetes up and running"; + homepage = https://github.com/kubernetes/kops; + license = licenses.asl20; + maintainers = with maintainers; [offline zimbatm]; + platforms = platforms.unix; + }; + } // attrs'; +in rec { + + mkKops = generic; + + kops_1_12 = mkKops { + version = "1.12.2"; + sha256 = "0937crwifnld7r5pf5gvab9ibmf8k44dafr9y3hld2p01ijrari1"; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 77563721c587..5c1b20177883 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23635,7 +23635,11 @@ in kontemplate = callPackage ../applications/networking/cluster/kontemplate { }; - kops = callPackage ../applications/networking/cluster/kops { }; + inherit (callPackage ../applications/networking/cluster/kops {}) + mkKops + kops_1_12 + ; + kops = kops_1_12; lguf-brightness = callPackage ../misc/lguf-brightness { };