ligolo-ng: refactor

This commit is contained in:
Letgamer
2025-11-04 14:42:00 +01:00
parent e5b84fbba3
commit 75d0f2f221
+39 -10
View File
@@ -2,38 +2,67 @@
lib,
buildGoModule,
fetchFromGitHub,
nix-update-script,
pkgsCross ? { },
versionCheckHook,
}:
buildGoModule rec {
buildGoModule (finalAttrs: {
pname = "ligolo-ng";
version = "0.8.2";
src = fetchFromGitHub {
owner = "tnpitsecurity";
owner = "nicocha30";
repo = "ligolo-ng";
tag = "v${version}";
tag = "v${finalAttrs.version}";
hash = "sha256-ND0SFB0xj4WK6okNzChZWfK5bhNc4PTWuZoq/PodTW0=";
};
vendorHash = "sha256-oc85xNPMFeaPC7TMcSh3i3Msd8sCJ5QGFmi2fKjcyvk=";
postConfigure = ''
export CGO_ENABLED=0
'';
env.CGO_ENABLED = 0;
subPackages = [
"cmd/agent"
"cmd/proxy"
];
ldflags = [
"-s"
"-w"
"-extldflags '-static'"
"-X main.version=${finalAttrs.version}"
];
# This will prefix all the binaries with ligolo-
postInstall = ''
for f in $out/bin/*; do
mv "$f" "$(dirname "$f")/ligolo-$(basename "$f")"
done
'';
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgram = "${placeholder "out"}/bin/ligolo-agent";
versionCheckProgramArg = "--version";
doInstallCheck = true;
passthru = {
tests = {
win = pkgsCross.mingwW64.ligolo-ng or null;
linux64 = pkgsCross.gnu64.ligolo-ng or null;
};
updateScript = nix-update-script { };
};
# Tests require network access
doCheck = false;
meta = {
description = "Tunneling/pivoting tool that uses a TUN interface";
homepage = "https://github.com/tnpitsecurity/ligolo-ng";
changelog = "https://github.com/nicocha30/ligolo-ng/releases/tag/v${version}";
description = "Advanced TUN-based tunneling/pivoting tool";
homepage = "https://github.com/nicocha30/ligolo-ng";
changelog = "https://github.com/nicocha30/ligolo-ng/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ letgamer ];
platforms = lib.platforms.linux ++ lib.platforms.windows;
};
}
})