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

69 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";
version = "1.6.0";
commitHash = "2a7f9d4dc11b6c828bf35a0b3d0be709f3ed79b9";
2024-09-08 17:57:20 -05:00
src = fetchFromGitHub {
owner = "charmbracelet";
repo = "mods";
rev = commitHash;
2024-10-28 20:44:49 -05:00
hash = "sha256-23gtb8BOx/0c643/paRt7VFHEyMyF4Q4a5b5+a4+kNU=";
2024-09-08 17:57:20 -05:00
};
2024-10-28 20:44:49 -05:00
vendorHash = "sha256-RV/Nr60BpCLcUL2Yy1Dd2ScwoI0BhGhTb/igCEcJPjI=";
2024-09-08 17:57:20 -05:00
nativeBuildInputs = [
installShellFiles
];
ldflags = [
"-s"
"-w"
"-X=main.Version=${version}-${commitHash}"
];
# These tests require internet access.
checkFlags = [ "-skip=^TestLoad/http_url$|^TestLoad/https_url$" ];
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;
maintainers = with maintainers; [ dit7ya caarlos0 ];
mainProgram = "mods";
};
}