2024-07-27 06:49:29 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, buildGoModule, installShellFiles }:
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "nali";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "0.8.1";
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "zu1k";
|
|
|
|
repo = "nali";
|
|
|
|
rev = "v${version}";
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-5AI8TAKYFqjgLVKob9imrf7yVmXmAPq/zHh1bDfC5r0=";
|
2021-12-06 16:07:01 +00:00
|
|
|
};
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
vendorHash = "sha256-wIp/ShUddz+RIcsEuKWUfxsV/wNB2X1jZtIltBZ0ROM=";
|
2021-12-06 16:07:01 +00:00
|
|
|
subPackages = [ "." ];
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
CGO_ENABLED = 0;
|
|
|
|
ldflags = [ "-s" "-w" "-X github.com/zu1k/nali/internal/constant.Version=${version}" ];
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
|
|
export HOME="$TMPDIR"
|
|
|
|
# write to temp files to avoid race condition in config loading
|
|
|
|
$out/bin/nali completion bash > nali.bash
|
|
|
|
$out/bin/nali completion fish > nali.fish
|
|
|
|
$out/bin/nali completion zsh > nali.zsh
|
|
|
|
installShellCompletion --cmd nali nali.{bash,fish,zsh}
|
2023-04-29 16:46:19 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Offline tool for querying IP geographic information and CDN provider";
|
2021-12-06 16:07:01 +00:00
|
|
|
homepage = "https://github.com/zu1k/nali";
|
|
|
|
license = licenses.mit;
|
2022-06-26 10:26:21 +00:00
|
|
|
maintainers = with maintainers; [ diffumist xyenon ];
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "nali";
|
2021-12-06 16:07:01 +00:00
|
|
|
};
|
|
|
|
}
|