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

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

96 lines
2.1 KiB
Nix
Raw Normal View History

2021-12-30 08:56:26 +00:00
{ lib
, stdenv
, buildGoModule
, fetchFromGitHub
2022-04-10 19:32:13 +00:00
, installShellFiles
2021-12-30 08:56:26 +00:00
, btrfs-progs
, testers
, werf
2021-12-30 08:56:26 +00:00
}:
buildGoModule rec {
pname = "werf";
2022-12-22 08:03:55 +00:00
version = "1.2.193";
2021-12-30 08:56:26 +00:00
src = fetchFromGitHub {
owner = "werf";
repo = "werf";
rev = "v${version}";
2022-12-22 08:03:55 +00:00
hash = "sha256-4q+LtPwJa3gioOY90gUfCL4F/8jmtfkBKxBShg2xQas=";
2021-12-30 08:56:26 +00:00
};
2022-06-11 14:58:42 +00:00
2022-11-07 21:39:15 +00:00
vendorHash = "sha256-GjcmpHyjhjCWE5gQR/oTHfhHYg5WRu8uhgAuWhdxlYk=";
2022-06-11 14:58:42 +00:00
2021-12-30 08:56:26 +00:00
proxyVendor = true;
2022-06-11 14:58:42 +00:00
subPackages = [ "cmd/werf" ];
nativeBuildInputs = [ installShellFiles ];
2022-09-06 22:31:30 +00:00
buildInputs = lib.optionals stdenv.isLinux [ btrfs-progs ]
++ lib.optionals stdenv.hostPlatform.isGnu [ stdenv.cc.libc.static ];
2021-12-30 08:56:26 +00:00
2022-09-02 17:01:23 +00:00
CGO_ENABLED = if stdenv.isLinux then 1 else 0;
2022-06-11 14:58:42 +00:00
ldflags = [
"-s"
"-w"
"-X github.com/werf/werf/pkg/werf.Version=${src.rev}"
2022-10-25 14:38:40 +00:00
] ++ lib.optionals (CGO_ENABLED == 1) [
"-extldflags=-static"
2022-06-11 14:58:42 +00:00
"-linkmode external"
2021-12-30 08:56:26 +00:00
];
2022-06-11 14:58:42 +00:00
tags = [
"containers_image_openpgp"
"dfrunmount"
2022-10-25 14:38:40 +00:00
"dfrunnetwork"
"dfrunsecurity"
2022-06-11 14:58:42 +00:00
"dfssh"
2022-10-25 14:38:40 +00:00
] ++ lib.optionals (CGO_ENABLED == 1) [
2021-12-30 08:56:26 +00:00
"exclude_graphdriver_devicemapper"
"netgo"
"no_devmapper"
"osusergo"
"static_build"
];
2022-09-02 17:01:23 +00:00
preCheck = ''
# Test all targets.
unset subPackages
# Remove tests that require external services.
rm -rf \
integration/suites \
pkg/true_git/*test.go \
test/e2e
2022-09-06 22:31:30 +00:00
'' + lib.optionalString (CGO_ENABLED == 0) ''
# A workaround for osusergo.
export USER=nixbld
2022-09-02 17:01:23 +00:00
'';
2021-12-30 08:56:26 +00:00
2022-04-10 19:32:13 +00:00
postInstall = ''
installShellCompletion --cmd werf \
--bash <($out/bin/werf completion --shell=bash) \
--zsh <($out/bin/werf completion --shell=zsh)
'';
passthru.tests.version = testers.testVersion {
package = werf;
command = "werf version";
2022-09-06 22:31:30 +00:00
version = src.rev;
2022-07-05 22:35:19 +00:00
};
2021-12-30 08:56:26 +00:00
meta = with lib; {
description = "GitOps delivery tool";
2022-06-11 14:58:42 +00:00
longDescription = ''
The CLI tool gluing Git, Docker, Helm & Kubernetes with any CI system to
implement CI/CD and Giterminism.
'';
homepage = "https://werf.io";
changelog = "https://github.com/werf/werf/releases/tag/${src.rev}";
2021-12-30 08:56:26 +00:00
license = licenses.asl20;
maintainers = with maintainers; [ azahi ];
};
}