mochi/nixos/packages/charm-mods/default.nix

71 lines
1.5 KiB
Nix
Raw Normal View History

2024-09-08 17:57:20 -05:00
{
lib,
buildGoModule,
installShellFiles,
fetchFromGitHub,
gitUpdater,
testers,
mods,
}:
buildGoModule rec {
pname = "mods";
2025-03-03 17:08:24 -06:00
version = "1.7.0";
commitHash = "bf8337f9f4c586aaa267f8019ac2d0daa3b30129";
2024-09-08 17:57:20 -05:00
src = fetchFromGitHub {
owner = "charmbracelet";
repo = "mods";
rev = commitHash;
2025-03-03 17:08:24 -06:00
hash = "sha256-EoDia+7ObtpnTDjJMzOk9djyCrW0m9pIToNHEDZ8Ch8=";
2024-09-08 17:57:20 -05:00
};
2025-03-03 17:08:24 -06:00
vendorHash = "sha256-dnKvT3VcvidfDcgJ9FerjtReIOwvRZtJZiBwNx2BEQ8=";
2024-09-08 17:57:20 -05:00
nativeBuildInputs = [
installShellFiles
];
ldflags = [
"-s"
"-w"
"-X=main.Version=${version}-${commitHash}"
];
# These tests require internet access.
2025-03-03 17:08:24 -06:00
checkFlags = ["-skip=^TestLoad/http_url$|^TestLoad/https_url$"];
2024-09-08 17:57:20 -05:00
passthru = {
updateScript = gitUpdater {
rev-prefix = "v";
ignoredVersions = ".(rc|beta).*";
};
tests.version = testers.testVersion {
package = mods;
command = "HOME=$(mktemp -d) mods -v";
};
};
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}
'';
meta = with lib; {
description = "AI on the command line";
homepage = "https://github.com/charmbracelet/mods";
license = licenses.mit;
2024-12-27 21:30:25 -06:00
maintainers = with maintainers; [
dit7ya
caarlos0
];
2024-09-08 17:57:20 -05:00
mainProgram = "mods";
};
}