about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/networking/containerlab/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/networking/containerlab/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/networking/containerlab/default.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/networking/containerlab/default.nix b/nixpkgs/pkgs/tools/networking/containerlab/default.nix
new file mode 100644
index 000000000000..0a8b02af7cf5
--- /dev/null
+++ b/nixpkgs/pkgs/tools/networking/containerlab/default.nix
@@ -0,0 +1,46 @@
+{ lib
+, buildGoModule
+, fetchFromGitHub
+, installShellFiles
+}:
+
+buildGoModule rec {
+  pname = "containerlab";
+  version = "0.46.2";
+
+  src = fetchFromGitHub {
+    owner = "srl-labs";
+    repo = "containerlab";
+    rev = "v${version}";
+    hash = "sha256-TzHTiAcN57FDdKBkZq5YwFwjP3s6OmN3431XGoMgnwI=";
+  };
+
+  nativeBuildInputs = [ installShellFiles ];
+
+  vendorHash = "sha256-3ALEwpFDnbSoTm3bxHZmRGkw1DeQ4Ikl6PpTosa1S6E=";
+
+  ldflags = [
+    "-s"
+    "-w"
+    "-X" "github.com/srl-labs/containerlab/cmd.version=${version}"
+    "-X" "github.com/srl-labs/containerlab/cmd.commit=${src.rev}"
+    "-X" "github.com/srl-labs/containerlab/cmd.date=1970-01-01T00:00:00Z"
+  ];
+
+  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)
+  '';
+
+  meta = with lib; {
+    description = "Container-based networking lab";
+    homepage = "https://containerlab.dev/";
+    changelog = "https://github.com/srl-labs/containerlab/releases/tag/${src.rev}";
+    license = licenses.bsd3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ janik ];
+  };
+}