depot/third_party/nixpkgs/pkgs/by-name/we/werf/package.nix
Luke Granger-Brown f92e137cfb
Some checks failed
/ combine-systems (push) Blocked by required conditions
/ build (x86_64-linux) (push) Failing after 11m44s
/ build (aarch64-linux) (push) Failing after 11m50s
/ build (push) Failing after 16m42s
Merge commit '1e2ed035f4bebc9adad02b365508ad96f7df87c1' into HEAD
2025-03-02 02:23:32 +00:00

109 lines
2.4 KiB
Nix

{
btrfs-progs,
buildGoModule,
fetchFromGitHub,
installShellFiles,
lib,
stdenv,
versionCheckHook,
}:
buildGoModule rec {
pname = "werf";
version = "2.24.0";
src = fetchFromGitHub {
owner = "werf";
repo = "werf";
rev = "v${version}";
hash = "sha256-IU9gVEG4MsUkdX4aJYKtd11WQLODU1IYAUyiuK+la40=";
};
vendorHash = "sha256-1HK90RqVvpuzkhbsLh0R6/CcdO/RrXRuOr3MBN0dcLU=";
proxyVendor = true;
subPackages = [ "cmd/werf" ];
nativeBuildInputs = [
installShellFiles
versionCheckHook
];
buildInputs =
lib.optionals stdenv.hostPlatform.isLinux [ btrfs-progs ]
++ lib.optionals stdenv.hostPlatform.isGnu [ stdenv.cc.libc.static ];
env.CGO_ENABLED = if stdenv.hostPlatform.isLinux then 1 else 0;
ldflags =
[
"-s"
"-w"
"-X github.com/werf/werf/v2/pkg/werf.Version=v${version}"
]
++ lib.optionals (env.CGO_ENABLED == 1) [
"-extldflags=-static"
"-linkmode external"
];
tags =
[
"containers_image_openpgp"
"dfrunmount"
"dfrunnetwork"
"dfrunsecurity"
"dfssh"
]
++ lib.optionals (env.CGO_ENABLED == 1) [
"cni"
"exclude_graphdriver_devicemapper"
"netgo"
"no_devmapper"
"osusergo"
"static_build"
];
preCheck =
''
# Test all packages.
unset subPackages
# Remove tests that require external services, usually a Docker daemon.
rm -rf \
integration/suites \
pkg/true_git/*_test.go \
test/e2e
''
+ lib.optionalString (env.CGO_ENABLED == 0) ''
# A workaround for osusergo.
export USER=nixbld
'';
doInstallCheck = true;
versionCheckProgramArg = "version";
postInstall = ''
for shell in bash fish zsh; do
installShellCompletion \
--cmd werf \
--$shell <($out/bin/werf completion --shell=$shell)
done
'';
meta = {
description = "GitOps delivery tool";
longDescription = ''
werf is a CNCF Sandbox CLI tool to implement full-cycle CI/CD to
Kubernetes easily. werf integrates into your CI system and leverages
familiar and reliable technologies, such as Git, Dockerfile, Helm, and
Buildah.
'';
homepage = "https://werf.io";
changelog = "https://github.com/werf/werf/releases/tag/${src.rev}";
license = lib.licenses.asl20;
maintainers = [ lib.maintainers.azahi ];
mainProgram = "werf";
};
}