gosmee: migrate to finalAttrs pattern and add best practices

- Use finalAttrs pattern instead of rec for better self-referencing
- Change rev to tag for more semantic git fetching
- Add versionCheckHook to verify binary functionality post-install
- Add nix-update-script for automated version updates
- Add changelog URL and mainProgram to meta
- Improve consistency with modern nixpkgs patterns (following lazyworktree)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester
2026-01-16 23:50:00 +01:00
parent ae49e5f57e
commit 3b83e6257f
+14 -4
View File
@@ -4,24 +4,27 @@
buildGoModule,
fetchFromGitHub,
installShellFiles,
versionCheckHook,
nix-update-script,
}:
buildGoModule rec {
buildGoModule (finalAttrs: {
pname = "gosmee";
version = "0.28.3";
src = fetchFromGitHub {
owner = "chmouel";
repo = "gosmee";
rev = "v${version}";
tag = "v${finalAttrs.version}";
hash = "sha256-97Z/q0cOX4zPGYaeAKqxm3sb7WfJ1fpUcMhuqHsPG1c=";
};
vendorHash = null;
nativeBuildInputs = [ installShellFiles ];
postPatch = ''
printf ${version} > gosmee/templates/version
printf ${finalAttrs.version} > gosmee/templates/version
'';
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
@@ -31,13 +34,20 @@ buildGoModule rec {
--zsh <($out/bin/gosmee completion zsh)
'';
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
passthru.updateScript = nix-update-script { };
meta = {
description = "Command line server and client for webhooks deliveries (and https://smee.io)";
homepage = "https://github.com/chmouel/gosmee";
changelog = "https://github.com/chmouel/gosmee/releases/tag/v${finalAttrs.version}";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [
vdemeester
chmouel
];
mainProgram = "gosmee";
};
}
})