somo: init at 1.1.0

Defelo refined this package with following points

* avoid `finalAttrs.src` in `meta.changelog`
* remove redundant code of `versionCheckProgram`

Co-authored-by: Felix Bargfeldt <41747605+Defelo@users.noreply.github.com>
This commit is contained in:
Kenichi Kamiya 2025-07-09 19:18:22 +09:00
parent 725f7920ae
commit 93b8f2e320
No known key found for this signature in database
GPG Key ID: 9BE4016A38165CCB

View File

@ -0,0 +1,61 @@
{
lib,
stdenv,
rustPlatform,
fetchFromGitHub,
installShellFiles,
versionCheckHook,
nix-update-script,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "somo";
version = "1.1.0";
src = fetchFromGitHub {
owner = "theopfr";
repo = "somo";
tag = "v${finalAttrs.version}";
hash = "sha256-HUTaBSy3FemAQH1aKZYTJnUWiq0bU/H6c5Gz3yamPiA=";
};
cargoHash = "sha256-e3NrEfbWz6h9q4TJnn8jnRmMJbeaEc4Yo3hFlaRLzzQ=";
nativeBuildInputs =
[
installShellFiles
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# Avoids "couldn't find any valid shared libraries matching: ['libclang.dylib']" error on darwin in sandbox mode.
rustPlatform.bindgenHook
];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd somo \
--bash <("$out/bin/somo" generate-completions bash) \
--zsh <("$out/bin/somo" generate-completions zsh) \
--fish <("$out/bin/somo" generate-completions fish)
'';
nativeInstallCheckInputs = [
versionCheckHook
];
doInstallCheck = true;
versionCheckProgramArg = "--version";
passthru = {
updateScript = nix-update-script { };
};
meta = {
description = "Socket and port monitoring tool";
homepage = "https://github.com/theopfr/somo";
changelog = "https://github.com/theopfr/somo/blob/v${finalAttrs.version}/CHANGELOG.md";
license = lib.licenses.mit;
platforms = with lib.platforms; linux ++ darwin;
maintainers = with lib.maintainers; [
kachick
];
mainProgram = "somo";
};
})