61 lines
1.5 KiB
Nix
61 lines
1.5 KiB
Nix
{
|
|
lib,
|
|
buildGoModule,
|
|
fetchFromGitHub,
|
|
installShellFiles,
|
|
versionCheckHook,
|
|
}:
|
|
|
|
buildGoModule (finalAttrs: {
|
|
pname = "containerlab";
|
|
version = "0.68.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "srl-labs";
|
|
repo = "containerlab";
|
|
tag = "v${finalAttrs.version}";
|
|
hash = "sha256-x6QDwduAMCD+Trj0awQXW0Tdleb2U6YBi/7mdMB6V/8=";
|
|
};
|
|
|
|
vendorHash = "sha256-XRgKfRw6VGg+lkbtPWUVNfAk5a7ZdFwVmhjtM7uSwHs=";
|
|
|
|
nativeBuildInputs = [
|
|
installShellFiles
|
|
versionCheckHook
|
|
];
|
|
|
|
ldflags = [
|
|
"-s"
|
|
"-w"
|
|
"-X github.com/srl-labs/containerlab/cmd/version.Version=${finalAttrs.version}"
|
|
"-X github.com/srl-labs/containerlab/cmd/version.commit=${finalAttrs.src.rev}"
|
|
"-X github.com/srl-labs/containerlab/cmd/version.date=1970-01-01T00:00:00Z"
|
|
];
|
|
|
|
preCheck = ''
|
|
# Fix failed TestLabelsInit test
|
|
export USER="runner"
|
|
'';
|
|
|
|
postInstall = ''
|
|
local INSTALL="$out/bin/containerlab"
|
|
installShellCompletion --cmd containerlab \
|
|
--bash <($out/bin/containerlab completion bash) \
|
|
--fish <($out/bin/containerlab completion fish) \
|
|
--zsh <($out/bin/containerlab completion zsh)
|
|
'';
|
|
|
|
doInstallCheck = true;
|
|
versionCheckProgramArg = "version";
|
|
|
|
meta = {
|
|
description = "Container-based networking lab";
|
|
homepage = "https://containerlab.dev/";
|
|
changelog = "https://github.com/srl-labs/containerlab/releases/tag/v${finalAttrs.version}";
|
|
license = lib.licenses.bsd3;
|
|
platforms = lib.platforms.linux;
|
|
maintainers = with lib.maintainers; [ aaronjheng ];
|
|
mainProgram = "containerlab";
|
|
};
|
|
})
|