fluxcd: refactor

- move top-level to by-name
- remove nested with in meta
- replace sha256 with hash
- use stdenv.buildPlatform.canExecute
- nixfmt
- minor clean-up
This commit is contained in:
superherointj 2024-06-12 19:24:30 -03:00
parent 87568d824d
commit 296a3e4979
3 changed files with 27 additions and 21 deletions

View File

@ -1,9 +1,10 @@
{ lib
, stdenv
, buildGoModule
, fetchFromGitHub
, fetchzip
, installShellFiles
{
buildGoModule,
fetchFromGitHub,
fetchzip,
installShellFiles,
lib,
stdenv,
}:
let
@ -12,13 +13,13 @@ let
manifestsSha256 = "sha256-PdhR+UDquIJWtpSymtT6V7qO5fVJOkFz6RGzAx7xeb4=";
manifests = fetchzip {
url =
"https://github.com/fluxcd/flux2/releases/download/v${version}/manifests.tar.gz";
sha256 = manifestsSha256;
url = "https://github.com/fluxcd/flux2/releases/download/v${version}/manifests.tar.gz";
hash = manifestsSha256;
stripRoot = false;
};
in
in buildGoModule rec {
buildGoModule rec {
pname = "fluxcd";
inherit version;
@ -26,7 +27,7 @@ in buildGoModule rec {
owner = "fluxcd";
repo = "flux2";
rev = "v${version}";
inherit sha256;
hash = sha256;
};
vendorHash = "sha256-0YH3pgFrsnh5jIsZpj/sIgfiOCTtIlPltMS5mdGz1eM=";
@ -38,7 +39,11 @@ in buildGoModule rec {
rm source/cmd/flux/create_secret_git_test.go
'';
ldflags = [ "-s" "-w" "-X main.VERSION=${version}" ];
ldflags = [
"-s"
"-w"
"-X main.VERSION=${version}"
];
subPackages = [ "cmd/flux" ];
@ -53,7 +58,7 @@ in buildGoModule rec {
$out/bin/flux --version | grep ${version} > /dev/null
'';
postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
for shell in bash fish zsh; do
$out/bin/flux completion $shell > flux.$shell
installShellCompletion flux.$shell
@ -62,18 +67,21 @@ in buildGoModule rec {
passthru.updateScript = ./update.sh;
meta = with lib; {
description =
"Open and extensible continuous delivery solution for Kubernetes";
meta = {
changelog = "https://github.com/fluxcd/flux2/releases/tag/v${version}";
description = "Open and extensible continuous delivery solution for Kubernetes";
downloadPage = "https://github.com/fluxcd/flux2/";
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";
downloadPage = "https://github.com/fluxcd/flux2/releases/tag/v${version}";
license = licenses.asl20;
maintainers = with maintainers; [ bryanasdev000 jlesquembre ];
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [
bryanasdev000
jlesquembre
];
mainProgram = "flux";
};
}

View File

@ -32246,8 +32246,6 @@ with pkgs;
fluxctl = callPackage ../applications/networking/cluster/fluxctl { };
fluxcd = callPackage ../applications/networking/cluster/fluxcd { };
linkerd = callPackage ../applications/networking/cluster/linkerd { };
linkerd_edge = callPackage ../applications/networking/cluster/linkerd/edge.nix { };
linkerd_stable = linkerd;