mods: general improvements to the mods package (#425744)

authored by Aleksana and committed by GitHub 86e396ed 3b9a9692

+23 -15
+23 -15
pkgs/by-name/mo/mods/package.nix
··· 1 { 2 lib, 3 buildGoModule, 4 installShellFiles, 5 fetchFromGitHub, 6 gitUpdater, 7 testers, 8 mods, 9 }: 10 11 - buildGoModule rec { 12 pname = "mods"; 13 version = "1.7.0"; 14 15 src = fetchFromGitHub { 16 owner = "charmbracelet"; 17 repo = "mods"; 18 - rev = "v${version}"; 19 hash = "sha256-wzLYkcgUWPzghJEhYRh7HH19Rqov1RJAxdgp3AGnOTY="; 20 }; 21 22 vendorHash = "sha256-L+4vkh7u6uMm5ICMk8ke5RVY1oYeKMYWVYYq9YqpKiw="; 23 24 - nativeBuildInputs = [ 25 installShellFiles 26 ]; 27 28 ldflags = [ 29 "-s" 30 "-w" 31 - "-X=main.Version=${version}" 32 ]; 33 34 # These tests require internet access. ··· 46 }; 47 }; 48 49 - postInstall = '' 50 - export HOME=$(mktemp -d) 51 - $out/bin/mods man > mods.1 52 - $out/bin/mods completion bash > mods.bash 53 - $out/bin/mods completion fish > mods.fish 54 - $out/bin/mods completion zsh > mods.zsh 55 - 56 - installManPage mods.1 57 - installShellCompletion mods.{bash,fish,zsh} 58 - ''; 59 60 meta = { 61 description = "AI on the command line"; ··· 64 maintainers = with lib.maintainers; [ 65 dit7ya 66 caarlos0 67 ]; 68 mainProgram = "mods"; 69 }; 70 - }
··· 1 { 2 lib, 3 + stdenv, 4 buildGoModule, 5 installShellFiles, 6 fetchFromGitHub, 7 gitUpdater, 8 testers, 9 mods, 10 + installShellCompletions ? stdenv.buildPlatform.canExecute stdenv.hostPlatform, 11 + installManPages ? stdenv.buildPlatform.canExecute stdenv.hostPlatform, 12 }: 13 14 + buildGoModule (finalAttrs: { 15 pname = "mods"; 16 version = "1.7.0"; 17 18 src = fetchFromGitHub { 19 owner = "charmbracelet"; 20 repo = "mods"; 21 + tag = "v${finalAttrs.version}"; 22 hash = "sha256-wzLYkcgUWPzghJEhYRh7HH19Rqov1RJAxdgp3AGnOTY="; 23 }; 24 25 vendorHash = "sha256-L+4vkh7u6uMm5ICMk8ke5RVY1oYeKMYWVYYq9YqpKiw="; 26 27 + nativeBuildInputs = lib.optionals (installManPages || installShellCompletions) [ 28 installShellFiles 29 ]; 30 31 ldflags = [ 32 "-s" 33 "-w" 34 + "-X=main.Version=${finalAttrs.version}" 35 ]; 36 37 # These tests require internet access. ··· 49 }; 50 }; 51 52 + postInstall = 53 + '' 54 + export HOME=$(mktemp -d) 55 + '' 56 + + lib.optionalString installManPages '' 57 + $out/bin/mods man > ./mods.1 58 + installManPage ./mods.1 59 + '' 60 + + lib.optionalString installShellCompletions '' 61 + installShellCompletion --cmd mods \ 62 + --bash <($out/bin/mods completion bash) \ 63 + --fish <($out/bin/mods completion fish) \ 64 + --zsh <($out/bin/mods completion zsh) 65 + ''; 66 67 meta = { 68 description = "AI on the command line"; ··· 71 maintainers = with lib.maintainers; [ 72 dit7ya 73 caarlos0 74 + delafthi 75 ]; 76 mainProgram = "mods"; 77 }; 78 + })