nixpkgs/pkgs/applications/networking/cluster/fluxcd/default.nix
2022-08-13 14:48:07 -03:00

72 lines
1.9 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub, fetchzip, installShellFiles, stdenv }:
let
version = "0.32.0";
sha256 = "1gxfnf47i26kzgsaxbl2pf02hn5dwb290qs894hz196jc2021a7n";
manifestsSha256 = "19jdmdipbshqv06xzkx5p4ym0x2jgrvnvsq38dg6b4y0iwzd9nmm";
manifests = fetchzip {
url =
"https://github.com/fluxcd/flux2/releases/download/v${version}/manifests.tar.gz";
sha256 = manifestsSha256;
stripRoot = false;
};
in buildGoModule rec {
pname = "fluxcd";
inherit version;
src = fetchFromGitHub {
owner = "fluxcd";
repo = "flux2";
rev = "v${version}";
inherit sha256;
};
vendorSha256 = "sha256-pVK+VFfAk0jFp6u5mVB2p8CamPkD3/KRhYNy3zHUVCE=";
postUnpack = ''
cp -r ${manifests} source/cmd/flux/manifests
'';
patches = [ ./patches/disable-tests-ssh_key.patch ];
ldflags = [ "-s" "-w" "-X main.VERSION=${version}" ];
subPackages = [ "cmd/flux" ];
# Required to workaround test error:
# panic: mkdir /homeless-shelter: permission denied
HOME = "$TMPDIR";
nativeBuildInputs = [ installShellFiles ];
doInstallCheck = true;
installCheckPhase = ''
$out/bin/flux --version | grep ${version} > /dev/null
'';
postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
for shell in bash fish zsh; do
$out/bin/flux completion $shell > flux.$shell
installShellCompletion flux.$shell
done
'';
passthru.updateScript = ./update.sh;
meta = with lib; {
description =
"Open and extensible continuous delivery solution for Kubernetes";
longDescription = ''
Flux is a tool for keeping Kubernetes clusters in sync
with sources of configuration (like Git repositories), and automating
updates to configuration when there is new code to deploy.
'';
homepage = "https://fluxcd.io";
license = licenses.asl20;
maintainers = with maintainers; [ bryanasdev000 jlesquembre superherointj ];
mainProgram = "flux";
};
}