mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-15 09:23:37 +00:00
4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
72 lines
1.9 KiB
Nix
72 lines
1.9 KiB
Nix
{ stdenv, lib, buildGoPackage, fetchFromGitHub, go-bindata, installShellFiles }:
|
|
let
|
|
goPackagePath = "k8s.io/kops";
|
|
|
|
generic = { version, sha256, rev ? version, ... }@attrs:
|
|
let attrs' = builtins.removeAttrs attrs [ "version" "sha256" "rev" ]; in
|
|
buildGoPackage
|
|
{
|
|
pname = "kops";
|
|
inherit version;
|
|
|
|
inherit goPackagePath;
|
|
|
|
src = fetchFromGitHub {
|
|
rev = rev;
|
|
owner = "kubernetes";
|
|
repo = "kops";
|
|
inherit sha256;
|
|
};
|
|
|
|
nativeBuildInputs = [ go-bindata installShellFiles ];
|
|
subPackages = [ "cmd/kops" ];
|
|
|
|
buildFlagsArray = ''
|
|
-ldflags=
|
|
-X k8s.io/kops.Version=${version}
|
|
-X k8s.io/kops.GitVersion=${version}
|
|
'';
|
|
|
|
preBuild = ''
|
|
(cd go/src/k8s.io/kops
|
|
go-bindata -o upup/models/bindata.go -pkg models -prefix upup/models/ upup/models/...)
|
|
'';
|
|
|
|
postInstall = ''
|
|
for shell in bash zsh; do
|
|
$out/bin/kops completion $shell > kops.$shell
|
|
installShellCompletion kops.$shell
|
|
done
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Easiest way to get a production Kubernetes up and running";
|
|
homepage = "https://github.com/kubernetes/kops";
|
|
changelog = "https://github.com/kubernetes/kops/tree/master/docs/releases";
|
|
license = licenses.asl20;
|
|
maintainers = with maintainers; [ offline zimbatm kampka ];
|
|
platforms = platforms.unix;
|
|
};
|
|
} // attrs';
|
|
in
|
|
rec {
|
|
|
|
mkKops = generic;
|
|
|
|
kops_1_16 = mkKops {
|
|
version = "1.16.4";
|
|
sha256 = "0qi80hzd5wc8vn3y0wsckd7pq09xcshpzvcr7rl5zd4akxb0wl3f";
|
|
};
|
|
|
|
kops_1_17 = mkKops {
|
|
version = "1.17.2";
|
|
sha256 = "0fmrzjz163hda6sl1jkl7cmg8fw6mmqb9953048jnhmd3w428xlz";
|
|
};
|
|
|
|
kops_1_18 = mkKops rec {
|
|
version = "1.18.2";
|
|
sha256 = "17na83j6sfhk69w9ssvicc0xd1904z952ad3zzbpha50lcy6nlhp";
|
|
rev = "v${version}";
|
|
};
|
|
}
|