2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
2024-04-21 15:54:59 +00:00
|
|
|
, fetchpatch
|
2023-07-15 17:15:38 +00:00
|
|
|
, installShellFiles
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "labctl";
|
|
|
|
version = "0.0.22";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "labctl";
|
|
|
|
repo = "labctl";
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-84t7qhLafNyPLgHmFQUsizEn6Us44dDTercGEm9lup4=";
|
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
patches = [
|
|
|
|
# Fix build failure with Go 1.21 by updating go4.org/unsafe/assume-no-moving-gc
|
|
|
|
# See https://github.com/labctl/labctl/pull/4
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/labctl/labctl/commit/615d05e94b991362beddce71c7ee34eae7fc93ff.patch";
|
|
|
|
hash = "sha256-4JrXSsg8rfuH6i8XyLd/qO6AibkRMDBIpfT8r1yS75c=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
vendorHash = "sha256-Ycr/IZckIFysS9Goes58hhgh96UMRHjYWfWlQU23mXk=";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-X=github.com/labctl/labctl/app.version=${version}"
|
|
|
|
"-X=github.com/labctl/labctl/app.commit=${src.rev}"
|
|
|
|
"-X=github.com/labctl/labctl/app.date=1970-01-01T00:00:00Z"
|
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
local INSTALL="$out/bin/labctl"
|
|
|
|
installShellCompletion --cmd labctl \
|
|
|
|
--bash <(echo "complete -C $INSTALL labctl") \
|
|
|
|
--zsh <(echo "complete -o nospace -C $INSTALL labctl")
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "collection of helper tools for network engineers, while configuring and experimenting with their own network labs";
|
|
|
|
homepage = "https://labctl.net";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ janik ];
|
2024-02-29 20:09:43 +00:00
|
|
|
mainProgram = "labctl";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
}
|