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 11:56:26 +03:00
{ lib
, stdenv
, buildGoModule
, fetchFromGitHub
2022-04-10 22:32:13 +03:00
, installShellFiles
2021-12-30 11:56:26 +03:00
, btrfs-progs
, testers
, werf
2021-12-30 11:56:26 +03:00
}:
buildGoModule rec {
pname = "werf";
2023-06-17 11:23:11 +00:00
version = "1.2.241";
2021-12-30 11:56:26 +03:00
src = fetchFromGitHub {
owner = "werf";
repo = "werf";
rev = "v${version}";
2023-06-17 11:23:11 +00:00
hash = "sha256-KEcHKMWe6t2TWbpQecpEDEdldi+9b0E5t+g+Zkhhqtw=";
2021-12-30 11:56:26 +03:00
};
2022-06-11 17:58:42 +03:00
2023-06-17 11:23:11 +00:00
vendorHash = "sha256-iP1j11bWs5Laa1f3VEt/w+NMSWhHD8Kf4cwAZiy9sRc=";
2022-06-11 17:58:42 +03:00
2021-12-30 11:56:26 +03:00
proxyVendor = true;
2022-06-11 17:58:42 +03:00
subPackages = [ "cmd/werf" ];
nativeBuildInputs = [ installShellFiles ];
2022-09-07 01:31:30 +03:00
buildInputs = lib.optionals stdenv.isLinux [ btrfs-progs ]
++ lib.optionals stdenv.hostPlatform.isGnu [ stdenv.cc.libc.static ];
2021-12-30 11:56:26 +03:00
2022-09-02 20:01:23 +03:00
CGO_ENABLED = if stdenv.isLinux then 1 else 0;
2022-06-11 17:58:42 +03:00
ldflags = [
"-s"
"-w"
"-X github.com/werf/werf/pkg/werf.Version=${src.rev}"
2022-10-25 17:38:40 +03:00
] ++ lib.optionals (CGO_ENABLED == 1) [
"-extldflags=-static"
2022-06-11 17:58:42 +03:00
"-linkmode external"
2021-12-30 11:56:26 +03:00
];
2022-06-11 17:58:42 +03:00
tags = [
"containers_image_openpgp"
"dfrunmount"
2022-10-25 17:38:40 +03:00
"dfrunnetwork"
"dfrunsecurity"
2022-06-11 17:58:42 +03:00
"dfssh"
2022-10-25 17:38:40 +03:00
] ++ lib.optionals (CGO_ENABLED == 1) [
2021-12-30 11:56:26 +03:00
"exclude_graphdriver_devicemapper"
"netgo"
"no_devmapper"
"osusergo"
"static_build"
];
2022-09-02 20:01:23 +03: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-07 01:31:30 +03:00
'' + lib.optionalString (CGO_ENABLED == 0) ''
# A workaround for osusergo.
export USER=nixbld
2022-09-02 20:01:23 +03:00
'';
2021-12-30 11:56:26 +03:00
2022-04-10 22:32:13 +03: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-07 01:31:30 +03:00
version = src.rev;
2022-07-06 01:35:19 +03:00
};
2021-12-30 11:56:26 +03:00
meta = with lib; {
description = "GitOps delivery tool";
2022-06-11 17:58:42 +03: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 11:56:26 +03:00
license = licenses.asl20;
maintainers = with maintainers; [ azahi ];
};
}