From 296a3e49797857c11254fe042205b706141870ef Mon Sep 17 00:00:00 2001 From: superherointj <5861043+superherointj@users.noreply.github.com> Date: Wed, 12 Jun 2024 19:24:30 -0300 Subject: [PATCH 1/2] 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 --- .../fl/fluxcd/package.nix} | 46 +++++++++++-------- .../cluster => by-name/fl}/fluxcd/update.sh | 0 pkgs/top-level/all-packages.nix | 2 - 3 files changed, 27 insertions(+), 21 deletions(-) rename pkgs/{applications/networking/cluster/fluxcd/default.nix => by-name/fl/fluxcd/package.nix} (64%) rename pkgs/{applications/networking/cluster => by-name/fl}/fluxcd/update.sh (100%) diff --git a/pkgs/applications/networking/cluster/fluxcd/default.nix b/pkgs/by-name/fl/fluxcd/package.nix similarity index 64% rename from pkgs/applications/networking/cluster/fluxcd/default.nix rename to pkgs/by-name/fl/fluxcd/package.nix index 75689b47710f..c63310bee4f3 100644 --- a/pkgs/applications/networking/cluster/fluxcd/default.nix +++ b/pkgs/by-name/fl/fluxcd/package.nix @@ -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"; }; } diff --git a/pkgs/applications/networking/cluster/fluxcd/update.sh b/pkgs/by-name/fl/fluxcd/update.sh similarity index 100% rename from pkgs/applications/networking/cluster/fluxcd/update.sh rename to pkgs/by-name/fl/fluxcd/update.sh diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 522654281f11..6c5daf304c0f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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; From 380fa361709e82a81b049d640ea80ac397d84f68 Mon Sep 17 00:00:00 2001 From: superherointj <5861043+superherointj@users.noreply.github.com> Date: Wed, 12 Jun 2024 19:34:54 -0300 Subject: [PATCH 2/2] fluxcd: add superherointj as maintainer --- pkgs/by-name/fl/fluxcd/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/by-name/fl/fluxcd/package.nix b/pkgs/by-name/fl/fluxcd/package.nix index c63310bee4f3..712f075459b6 100644 --- a/pkgs/by-name/fl/fluxcd/package.nix +++ b/pkgs/by-name/fl/fluxcd/package.nix @@ -81,6 +81,7 @@ buildGoModule rec { maintainers = with lib.maintainers; [ bryanasdev000 jlesquembre + superherointj ]; mainProgram = "flux"; };