mods: general improvements to the mods package (#425744)
This commit is contained in:
@@ -1,34 +1,37 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
buildGoModule,
|
||||
installShellFiles,
|
||||
fetchFromGitHub,
|
||||
gitUpdater,
|
||||
testers,
|
||||
mods,
|
||||
installShellCompletions ? stdenv.buildPlatform.canExecute stdenv.hostPlatform,
|
||||
installManPages ? stdenv.buildPlatform.canExecute stdenv.hostPlatform,
|
||||
}:
|
||||
|
||||
buildGoModule rec {
|
||||
buildGoModule (finalAttrs: {
|
||||
pname = "mods";
|
||||
version = "1.7.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "charmbracelet";
|
||||
repo = "mods";
|
||||
rev = "v${version}";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-wzLYkcgUWPzghJEhYRh7HH19Rqov1RJAxdgp3AGnOTY=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-L+4vkh7u6uMm5ICMk8ke5RVY1oYeKMYWVYYq9YqpKiw=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
nativeBuildInputs = lib.optionals (installManPages || installShellCompletions) [
|
||||
installShellFiles
|
||||
];
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X=main.Version=${version}"
|
||||
"-X=main.Version=${finalAttrs.version}"
|
||||
];
|
||||
|
||||
# These tests require internet access.
|
||||
@@ -46,16 +49,20 @@ buildGoModule rec {
|
||||
};
|
||||
};
|
||||
|
||||
postInstall = ''
|
||||
export HOME=$(mktemp -d)
|
||||
$out/bin/mods man > mods.1
|
||||
$out/bin/mods completion bash > mods.bash
|
||||
$out/bin/mods completion fish > mods.fish
|
||||
$out/bin/mods completion zsh > mods.zsh
|
||||
|
||||
installManPage mods.1
|
||||
installShellCompletion mods.{bash,fish,zsh}
|
||||
'';
|
||||
postInstall =
|
||||
''
|
||||
export HOME=$(mktemp -d)
|
||||
''
|
||||
+ lib.optionalString installManPages ''
|
||||
$out/bin/mods man > ./mods.1
|
||||
installManPage ./mods.1
|
||||
''
|
||||
+ lib.optionalString installShellCompletions ''
|
||||
installShellCompletion --cmd mods \
|
||||
--bash <($out/bin/mods completion bash) \
|
||||
--fish <($out/bin/mods completion fish) \
|
||||
--zsh <($out/bin/mods completion zsh)
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "AI on the command line";
|
||||
@@ -64,7 +71,8 @@ buildGoModule rec {
|
||||
maintainers = with lib.maintainers; [
|
||||
dit7ya
|
||||
caarlos0
|
||||
delafthi
|
||||
];
|
||||
mainProgram = "mods";
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user