nixpkgs/pkgs/applications/networking/cluster/argo/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

95 lines
2.4 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, buildGoModule
, fetchFromGitHub
, installShellFiles
, pkgsBuildBuild
}:
2019-01-26 00:43:58 +00:00
2020-02-29 01:47:25 +00:00
let
# Argo can package a static server in the CLI using the `staticfiles` go module.
# We build the CLI without the static server for simplicity, but the tool is still required for
# compilation to succeed.
# See: https://github.com/argoproj/argo/blob/d7690e32faf2ac5842468831daf1443283703c25/Makefile#L117
staticfiles = pkgsBuildBuild.buildGoModule rec {
2020-02-29 01:47:25 +00:00
name = "staticfiles";
2020-02-29 01:47:25 +00:00
src = fetchFromGitHub {
owner = "bouk";
repo = "staticfiles";
rev = "827d7f6389cd410d0aa3f3d472a4838557bf53dd";
hash = "sha256-wchj5KjhTmhc4XVW0sRFCcyx5W9am8TNAIhej3WFWXU=";
2020-02-29 01:47:25 +00:00
};
vendorHash = null;
excludedPackages = [ "./example" ];
preBuild = ''
cp ${./staticfiles.go.mod} go.mod
'';
ldflags = [ "-s" "-w" ];
2020-02-29 01:47:25 +00:00
};
in
buildGoModule rec {
pname = "argo";
2024-04-20 00:20:58 +00:00
version = "3.5.6";
2019-01-26 00:43:58 +00:00
src = fetchFromGitHub {
owner = "argoproj";
repo = "argo";
rev = "refs/tags/v${version}";
2024-04-20 00:20:58 +00:00
hash = "sha256-CcPY9eEpvDTIxilxHI+VBVVRxZy/82fi6uayBrGR/Dc=";
2019-01-26 00:43:58 +00:00
};
2024-04-20 00:20:58 +00:00
vendorHash = "sha256-ttpDGeANQyrTfRyNGFkmJFpE+nnjz8PZN+0HScBJ1yg=";
2020-02-29 01:47:25 +00:00
doCheck = false;
subPackages = [
"cmd/argo"
];
2019-01-26 00:43:58 +00:00
nativeBuildInputs = [
installShellFiles
];
2020-06-26 03:01:51 +00:00
2020-02-29 01:47:25 +00:00
preBuild = ''
mkdir -p ui/dist/app
echo "Built without static files" > ui/dist/app/index.html
${staticfiles}/bin/staticfiles -o server/static/files.go ui/dist/app
'';
2021-08-26 03:31:57 +00:00
ldflags = [
"-s"
"-w"
2021-08-26 03:31:57 +00:00
"-X github.com/argoproj/argo-workflows/v3.buildDate=unknown"
"-X github.com/argoproj/argo-workflows/v3.gitCommit=${src.rev}"
"-X github.com/argoproj/argo-workflows/v3.gitTag=${src.rev}"
"-X github.com/argoproj/argo-workflows/v3.gitTreeState=clean"
"-X github.com/argoproj/argo-workflows/v3.version=${version}"
];
2020-06-11 21:56:29 +00:00
2020-06-26 03:01:51 +00:00
postInstall = ''
for shell in bash zsh; do
2021-12-12 07:26:47 +00:00
${if (stdenv.buildPlatform == stdenv.hostPlatform)
then "$out/bin/argo"
else "${pkgsBuildBuild.argo}/bin/argo"
} completion $shell > argo.$shell
2020-06-26 03:01:51 +00:00
installShellCompletion argo.$shell
done
'';
meta = with lib; {
2019-01-26 00:43:58 +00:00
description = "Container native workflow engine for Kubernetes";
mainProgram = "argo";
homepage = "https://github.com/argoproj/argo";
changelog = "https://github.com/argoproj/argo-workflows/blob/v${version}/CHANGELOG.md";
2019-01-26 00:43:58 +00:00
license = licenses.asl20;
maintainers = with maintainers; [ groodt ];
platforms = platforms.unix;
};
2020-06-11 21:56:29 +00:00
}