Files
2026-03-29 15:37:56 +02:00

78 lines
1.6 KiB
Nix

{
lib,
rustPlatform,
fetchFromGitHub,
cmake,
installShellFiles,
pkg-config,
zstd,
stdenv,
darwin,
gitMinimal,
}:
let
inherit (darwin) libresolv;
in
rustPlatform.buildRustPackage (finalAttrs: {
pname = "onefetch";
version = "2.27.1";
src = fetchFromGitHub {
owner = "o2sh";
repo = "onefetch";
tag = finalAttrs.version;
hash = "sha256-aeVLlYDrX7FfZmx30k6hCcihdMUyZm7j72l540+PZJo=";
};
cargoHash = "sha256-WR8T/spHZqvwzQxwkQI81yMLBA6s6ral97rTmIW+vpg=";
cargoPatches = [
# enable pkg-config feature of zstd
./zstd-pkg-config.patch
];
nativeBuildInputs = [
cmake
installShellFiles
pkg-config
];
buildInputs = [
zstd
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
libresolv
];
nativeCheckInputs = [
gitMinimal
];
preCheck = ''
git init
git config user.name nixbld
git config user.email nixbld@example.com
git add .
git commit -m test
'';
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd onefetch \
--bash <($out/bin/onefetch --generate bash) \
--fish <($out/bin/onefetch --generate fish) \
--zsh <($out/bin/onefetch --generate zsh)
'';
meta = {
description = "Git repository summary on your terminal";
homepage = "https://github.com/o2sh/onefetch";
changelog = "https://github.com/o2sh/onefetch/blob/v${finalAttrs.version}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
kloenk
];
mainProgram = "onefetch";
};
})