rospo: modernize

This commit is contained in:
Nikolay Korotkiy
2025-06-22 22:56:46 +04:00
parent 9b713ee98a
commit c9f2eef679
+19 -10
View File
@@ -2,18 +2,19 @@
lib,
stdenv,
buildGoModule,
buildPackages,
fetchFromGitHub,
installShellFiles,
}:
buildGoModule rec {
buildGoModule (finalAttrs: {
pname = "rospo";
version = "0.15.0";
src = fetchFromGitHub {
owner = "ferama";
repo = "rospo";
rev = "v${version}";
tag = "v${finalAttrs.version}";
hash = "sha256-xfCjRAsKJxtYeY2Mx+l1tDtqAF0SKjTCJCh1gCG+Rl8=";
};
@@ -22,19 +23,27 @@ buildGoModule rec {
ldflags = [
"-s"
"-w"
"-X github.com/ferama/rospo/cmd.Version=${version}"
"-X github.com/ferama/rospo/cmd.Version=${finalAttrs.version}"
];
nativeBuildInputs = [ installShellFiles ];
doCheck = false;
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd rospo \
--bash <($out/bin/rospo completion bash) \
--fish <($out/bin/rospo completion fish) \
--zsh <($out/bin/rospo completion zsh)
'';
postInstall =
let
rospoBin =
if stdenv.buildPlatform.canExecute stdenv.hostPlatform then
placeholder "out"
else
buildPackages.rospo;
in
''
installShellCompletion --cmd rospo \
--bash <(${rospoBin}/bin/rospo completion bash) \
--fish <(${rospoBin}/bin/rospo completion fish) \
--zsh <(${rospoBin}/bin/rospo completion zsh)
'';
meta = {
description = "Simple, reliable, persistent ssh tunnels with embedded ssh server";
@@ -43,4 +52,4 @@ buildGoModule rec {
maintainers = with lib.maintainers; [ sikmir ];
mainProgram = "rospo";
};
}
})