2022-11-21 17:40:18 +00:00
|
|
|
{ lib
|
2021-07-04 02:40:35 +00:00
|
|
|
, rustPlatform
|
2022-11-21 17:40:18 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, installShellFiles
|
2022-01-25 03:21:06 +00:00
|
|
|
, pkg-config
|
|
|
|
, zstd
|
2022-11-21 17:40:18 +00:00
|
|
|
, stdenv
|
2021-07-04 02:40:35 +00:00
|
|
|
, CoreFoundation
|
|
|
|
, libresolv
|
|
|
|
, Security
|
2022-11-21 17:40:18 +00:00
|
|
|
, git
|
2021-07-04 02:40:35 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "onefetch";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "2.21.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "o2sh";
|
|
|
|
repo = pname;
|
2022-12-02 08:20:57 +00:00
|
|
|
rev = version;
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-KQs7b+skXQhHbfHIJkgowNY2FB6oS2V8TQFdkmElC/k=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
cargoHash = "sha256-gKA1MMahoaDFia8LR33GG3jRttZzHwpUpFawlCQcy7g=";
|
2022-11-21 17:40:18 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
cargoPatches = [
|
|
|
|
# enable pkg-config feature of zstd
|
|
|
|
./zstd-pkg-config.patch
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
nativeBuildInputs = [ cmake installShellFiles pkg-config ];
|
2022-01-25 03:21:06 +00:00
|
|
|
|
|
|
|
buildInputs = [ zstd ]
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ CoreFoundation libresolv Security ];
|
2022-11-21 17:40:18 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-11-21 17:40:18 +00:00
|
|
|
git
|
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
git init
|
|
|
|
git config user.name nixbld
|
|
|
|
git config user.email nixbld@example.com
|
|
|
|
git add .
|
|
|
|
git commit -m test
|
|
|
|
'';
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
2022-11-21 17:40:18 +00:00
|
|
|
installShellCompletion --cmd onefetch \
|
|
|
|
--bash <($out/bin/onefetch --generate bash) \
|
|
|
|
--fish <($out/bin/onefetch --generate fish) \
|
|
|
|
--zsh <($out/bin/onefetch --generate zsh)
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Git repository summary on your terminal";
|
|
|
|
homepage = "https://github.com/o2sh/onefetch";
|
2022-11-21 17:40:18 +00:00
|
|
|
changelog = "https://github.com/o2sh/onefetch/blob/v${version}/CHANGELOG.md";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
2023-08-04 22:07:22 +00:00
|
|
|
maintainers = with maintainers; [ Br1ght0ne figsoda kloenk ];
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "onefetch";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|